Skip to content

Fix zsh completion #892

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

Merged
merged 5 commits into from
Aug 10, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
add --no-descriptions also for zsh
  • Loading branch information
umbynos committed Aug 10, 2020
commit c4b26f1d41b1b29c17af7d6c6ddcd0b9d9ce0111
10 changes: 7 additions & 3 deletions cli/completion/completion.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ var (
completionNoDesc bool //Disable completion description for shells that support it
)

// NewCommand created a new `version` command
// NewCommand created a new `completion` command
func NewCommand() *cobra.Command {
command := &cobra.Command{
Use: "completion [bash|zsh|fish] [--no-descriptions]",
Expand All @@ -47,7 +47,7 @@ func NewCommand() *cobra.Command {
}

func run(cmd *cobra.Command, args []string) {
if completionNoDesc && (args[0] == "bash" || args[0] == "zsh") {
if completionNoDesc && (args[0] == "bash") {
feedback.Errorf("Error: command description is not supported by %v", args[0])
os.Exit(errorcodes.ErrGeneric)
}
Expand All @@ -56,7 +56,11 @@ func run(cmd *cobra.Command, args []string) {
cmd.Root().GenBashCompletion(os.Stdout)
break
case "zsh":
cmd.Root().GenZshCompletion(os.Stdout)
if completionNoDesc {
cmd.Root().GenZshCompletionNoDesc(os.Stdout)
} else {
cmd.Root().GenZshCompletion(os.Stdout)
}
break
case "fish":
buf := new(bytes.Buffer)
Expand Down