-
Notifications
You must be signed in to change notification settings - Fork 7.4k
add autocomplete descriptions for aliases and extensions #5447
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
Conversation
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.
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.
Thanks for making our completions better! I have some asks before this is ready to be merged
|
Thanks for taking care of the comments @samcoe! I unfortunately got pretty sick this week from you-know-what, so I really wasn't able to help out much T.T |
This is another tiny fix, but solves a headache I've been running into. Cobra supports nice descriptions for shell completions, even if specified via a
ValidArgsFunction-- simply append the description to the argument, separated by\t.In this PR, I give aliases the description "Alias for CMD", and give extensions the description "Extension REPO/URL, version VERSION".
For example, my
zshautocompletion now contains the entries:Obviously, we can tinker with/format these descriptions as needed -- I tried to match
git's alias autocompletion behavior for aliases and made this description up for extensions.Additionally, once the descriptions are added, Cobra automatically sorts the commands into the full commands list!