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 zsh completion #1531

Merged
merged 1 commit into from
Jan 26, 2019
Merged

Conversation

corneliusweig
Copy link
Contributor

@corneliusweig corneliusweig commented Jan 24, 2019

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

@codecov-io
Copy link

Codecov Report

Merging #1531 into master will decrease coverage by 0.02%.
The diff coverage is 0%.

Impacted file tree graph

@@            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
Impacted Files Coverage Δ
cmd/skaffold/app/cmd/completion.go 0% <0%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c946082...71c4639. Read the comment docs.

// 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 {
Copy link
Contributor

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?

Copy link
Contributor Author

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.

Copy link
Contributor

Choose a reason for hiding this comment

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

Make sense

@dgageot dgageot merged commit 6715948 into GoogleContainerTools:master Jan 26, 2019
@corneliusweig corneliusweig deleted the zsh-completion branch January 31, 2019 00:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants