Use native zsh completion script generator#3137
Merged
dgageot merged 2 commits intoGoogleContainerTools:masterfrom Nov 6, 2019
Merged
Use native zsh completion script generator#3137dgageot merged 2 commits intoGoogleContainerTools:masterfrom
dgageot merged 2 commits intoGoogleContainerTools:masterfrom
Conversation
So far, Skaffold used a wrapper code borrowed from kubectl to use the bash completion script for zsh. Cobra v0.0.5 introduced a native completion script generator for zsh. To support the `source <(...)` use-case, a minor tweak is necessary (also see spf13/cobra#887) Signed-off-by: Cornelius Weig <22861411+corneliusweig@users.noreply.github.com>
Codecov Report
|
balopat
approved these changes
Oct 30, 2019
Contributor
balopat
left a comment
There was a problem hiding this comment.
LGTM, thanks for this, awesome! :)
Contributor
Author
|
The credit goes to @babysnakes |
dgageot
suggested changes
Oct 31, 2019
cmd/skaffold/app/cmd/completion.go
Outdated
| out.Write(buf.Bytes()) | ||
| io.WriteString(out, zshTail) | ||
| _ = rootCmd(cmd).GenZshCompletion(out) | ||
| _, _ = io.WriteString(out, zshCompdef) |
Contributor
There was a problem hiding this comment.
Could it be?
rootCmd(cmd).GenZshCompletion(out)
io.WriteString(out, zshCompdef)
Contributor
Author
There was a problem hiding this comment.
Sure. Only my IDE complains about it, so I explicitly ignored the errors.
dgageot
approved these changes
Nov 6, 2019
Contributor
|
Let's ignore kokoro |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
So far, Skaffold used a wrapper code borrowed from kubectl to use the bash completion script for zsh. Cobra v0.0.5 introduced a native completion script generator for zsh. To support the
source <(...)use-case, a minor tweak is necessary (also see spf13/cobra#887).This PR does the required changes to make use of this native zsh completion scrip generator. It offers inline help text when making completion suggestions.
User facing changes
Users of the zsh completion script (generated with
source <( skaffold completion zsh)) will get improved completion suggestions:Submitter Checklist
These are the criteria that every PR should meet, please check them off as you
review them:
Reviewer Notes
Release Notes
Zsh completion now shows inline help text and understands the positional context of flags.