-
Notifications
You must be signed in to change notification settings - Fork 18
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 autocompletion generation for more shells #337
Conversation
This pull request has been linked to Clubhouse Story #30750: Aditional shell completion for exo 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.
Can't wait to test it with my zsh
shell!
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 cannot get it to work properly and get the below on zsh: (-> is tab)
acr@mbp13ar-3 zsh % exo li-> _arguments:comparguments:325: invalid option definition: (-C --config)-C[Specify an alternate config file [env EXOSCALE_CONFIG]]:
did you manage to get is work ?
@retrack indeed Zsh seems to require completion files to begin with an underscore. |
@zyegfryed can you confirm it works with your zsh shell? |
@falzm can you remind me how to run a local release with goreleaser? maybe using the output of that will help. I tested doing |
I'm doing the same and having the exact some behavior as you. I also remove the |
Same, not a @retrack you can run |
@falzm @retrack OK, I understand what's the issue: in our commands description we sometime refer to a way to define an option via an environment variable, for example, the |
^^ an alternate solution will be to escape the bracket from the description. But I guess we'll need to modify the underlying library ( Edit: already mentionned in cobra project as Issue spf13/cobra#989 (mentioning a closed PR spf13/cobra#899) ^^ bumping cobra to v1.1.0 should fix the issue since a revamped auto-completion for zsh was rolled out in that release. |
@zyegfryed cool, good thing that I have an on-going branch where I've upgraded Cobra to the latest version then. Thank you for looking into this! |
This change adds shell autocompletion support for Fish, PowerShell & Zsh.
@zyegfryed I've updated the branch, can I ask you for a new test? |
Sure. Test coming... |
So, completion works as expected for the first level commands/options, but fails when going deeper: ~ ❯ exo v<TAB>
version -- Print the version of exo
vm -- Compute instances management
~ ❯ exo --c<TAB>
~ ❯ exo --config but, this will fail: ~ ❯ exo vm cre
_arguments:comparguments:325: invalid option definition: (-C --config)-C[Specify an alternate config file [env EXOSCALE_CONFIG]]: |
^^ forget my previous comment, I forgot to delete the completion history or made another mistake while trying it, and after cleaning and re-installing it works as expected! GG! 🎉 |
This change adds shell autocompletion support for Fish, PowerShell &
Zsh.