-
Notifications
You must be signed in to change notification settings - Fork 502
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
base: main
Are you sure you want to change the base?
Conversation
51cd805
to
6acc66f
Compare
Learn Build status updates of commit 51cd805: ✅ Validation status: passed
For more details, please refer to the build report. For any questions, please:
|
Learn Build status updates of commit 6acc66f: ✅ Validation status: passed
For more details, please refer to the build report. For any questions, please:
|
Learn Build status updates of commit 2bb564a: ✅ Validation status: passed
For more details, please refer to the build report. For any questions, please:
|
.gitignore
Outdated
@@ -6,6 +6,7 @@ _themes/ | |||
_themes.MSDN.Modern/ | |||
_themes.VS.Modern/ | |||
.vscode | |||
.idea |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would suggest not adding this as this repo is never meant to be opened by idea.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I use Idea to open every Git repo.
Well, I'll remove this change.
@dbradish-microsoft Could you please help review this pr? |
Learn Build status updates of commit 08a68f1: ✅ Validation status: passed
For more details, please refer to the build report. For any questions, please:
|
Learn Build status updates of commit 08a68f1: ✅ Validation status: passed
For more details, please refer to the build report. For any questions, please:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The TDNF doc doesn't have a Troubleshooting H2, so one needs to be added.
Co-authored-by: Delora Bradish <[email protected]>
@dbradish-microsoft Thanks for the review, I've committed the suggestions. |
Learn Build status updates of commit 4822727: ✅ Validation status: passed
For more details, please refer to the build report. For any questions, please:
|
Missing a "no"? |
Co-authored-by: Jiashuo Li <[email protected]>
Learn Build status updates of commit dd4ed0a: ✅ Validation status: passed
For more details, please refer to the build report. For any questions, please:
|
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 |
There was a problem hiding this comment.
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
?
There was a problem hiding this comment.
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
andcomplete
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the purpose and source of this autoload -U +X bashcompinit
command?
Found some explanation on it:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Source of this command: https://stackoverflow.com/a/49277309/2251785
With the -U flag, alias expansion is suppressed when the function is loaded.
The flag +X attempts to load each name as an autoloaded function, but does not execute it. The exit status is zero (success) if the function was not previously defined and a definition for it was found. This does not replace any existing definition of the function. The exit status is nonzero (failure) if the function was already defined or when no definition was found. In the latter case the function remains undefined and marked for autoloading. If ksh-style autoloading is enabled, the function created will contain the contents of the file plus a call to the function itself appended to it, thus giving normal ksh autoloading behaviour on the first call to the function. If the -m flag is also given each name is treated as a pattern and all functions already marked for autoload that match the pattern are loaded.
The flags -z and -k mark the function to be autoloaded using the zsh or ksh style, as if the option KSH_AUTOLOAD were unset or were set, respectively.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The AWS document https://docs.aws.amazon.com/cli/v1/userguide/cli-configure-completion.html uses
autoload bashcompinit && bashcompinit
autoload -Uz compinit && compinit
Our document for MacOS https://learn.microsoft.com/en-us/cli/azure/install-azure-cli-macos#completion-isnt-working also only uses
autoload bashcompinit && bashcompinit
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the purpose and source of this
autoload -U +X bashcompinit
command?Found some explanation on it:
After reading these docs. It seems -Uz
is always the right option for autoload
.
"-Uz"? Yes, that is "the right thing"[tm] almost always, so I won't discuss it here. See the manual for details. --- http://bewatermyfriend.org/p/2012/003/
For +X
, it returns nonzero exit code if the function is defined. It saves some time if the .zshrc
has multiple autoload bashcompinit
.
Also, compinit
is also needed for completion.
Currently, there is no guide for tab completion for Linux.
Related issue: Azure/azure-cli#30441