Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add completion troubleshooting guide #4821

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions docs-ref-conceptual/includes/cli-install-linux-apt.md
Original file line number Diff line number Diff line change
Expand Up @@ -237,3 +237,5 @@ If your proxy doesn't use basic auth, __remove__ the `[username]:[password]@` po
In order to get the Microsoft signing key and get the package from our repository, your proxy needs to allow HTTPS connections to the following address: `https://packages.microsoft.com.

[!INCLUDE[troubleshoot-wsl.md](troubleshoot-wsl.md)]

[!INCLUDE[linux-completion.md](linux-completion.md)]
2 changes: 2 additions & 0 deletions docs-ref-conceptual/includes/cli-install-linux-dnf.md
Original file line number Diff line number Diff line change
Expand Up @@ -193,3 +193,5 @@ allow HTTPS connections to the following address:
* `https://packages.microsoft.com`

[!INCLUDE[troubleshoot-wsl.md](troubleshoot-wsl.md)]

[!INCLUDE[linux-completion.md](linux-completion.md)]
4 changes: 4 additions & 0 deletions docs-ref-conceptual/includes/cli-install-linux-tdnf.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,7 @@ sudo tdnf remove azure-cli
### Remove data

[!INCLUDE [remove-data-boilerplate.md](remove-data-boilerplate.md)]

bebound marked this conversation as resolved.
Show resolved Hide resolved
## Troubleshooting

[!INCLUDE[linux-completion.md](linux-completion.md)]
20 changes: 20 additions & 0 deletions docs-ref-conceptual/includes/linux-completion.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
author: bebound
ms.author: hanglei
ms.date: 11/29/2024
ms.topic: include
---
### Completion isn't working

For Bash users, the completion script is installed in `/etc/bash_completion.d/azure-cli`. Add the following line to your `~/.bashrc` file, then save and reload your Bash profile:
bebound marked this conversation as resolved.
Show resolved Hide resolved

```bash
source /etc/bash_completion.d/azure-cli
```

For Zsh users, add the following two lines in your `~/.zshrc` file, then save and reload your Zsh profile:

```zsh
autoload -U +X bashcompinit && bashcompinit
Copy link
Member

@jiasli jiasli Jan 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will this command automatically load /etc/bash_completion.d/azure-cli?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, bashcompinit only emulates the complete function in bash.

The function bashcompinit provides compatibility with bash’s programmable completion system. When run it will define the functions, compgen and complete which correspond to the bash builtins with the same names. It will then be possible to use completion specifications and functions written for bash.
--- https://zsh.sourceforge.io/Doc/Release/Completion-System.html

source /etc/bash_completion.d/azure-cli
```
2 changes: 1 addition & 1 deletion docs-ref-conceptual/install-azure-cli-macos.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ If you encounter a problem when installing the CLI through Homebrew, here are so

### Completion isn't working

The Homebrew formula of Azure CLI installs a completion file named `az` in the Homebrew-managed completions directory (default location is `/usr/local/etc/bash_completion.d/`). To enable completion, follow Homebrew's instructions [here](https://docs.brew.sh/Shell-Completion).
The Homebrew formula of Azure CLI installs a completion file named `az` in the Homebrew-managed completions directory (default location is `$(brew --prefix)/etc/bash_completion.d/`). To enable completion, follow Homebrew's instructions [here](https://docs.brew.sh/Shell-Completion).

For Zsh, add the following two lines to the bottom of your `.zshrc` file, then save and reload your Zsh profile.

Expand Down