-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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 zsh completion #1531
Add zsh completion #1531
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1531 +/- ##
==========================================
- Coverage 45.18% 45.15% -0.03%
==========================================
Files 115 115
Lines 4794 4797 +3
==========================================
Hits 2166 2166
- Misses 2403 2406 +3
Partials 225 225
Continue to review full report at Codecov.
|
// Only bash is supported for now. However, having args after | ||
// "completion" will help when supporting multiple shells | ||
Use: "completion bash", | ||
Use: "completion SHELL", | ||
Args: func(cmd *cobra.Command, args []string) error { | ||
if len(args) != 1 { |
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.
Could it default to bash
to not break existing usage?
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.
Well, skaffold completion
by itself was never valid but would print the help text. Only skaffold completion bash
was allowed and that didn't change.
I also checked kubectl
and minikube
and neither defaults to bash. So I think the current behavior is most consistent and should not be changed.
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.
Make sense
This PR adds command completion for skaffold in zsh. It uses the cobra zsh completion generator. Cobra has only limited support for completion in zsh, for example options are not included in the completion unlike for bash completion. However, a revised completion generator is in the works (spf13/cobra#646), so that it didn't seem reasonable to build a custom temporary solution. Therefore, this zsh completion for skaffold is still a bit basic, but hopefully will improve soon.
For the long command description, I aligned the help text with minikube.
Fixes #1012