diff --git a/internal/cli/cmd/completion/completion.go b/internal/cli/cmd/completion/completion.go index 2b0dac2b..4287e575 100644 --- a/internal/cli/cmd/completion/completion.go +++ b/internal/cli/cmd/completion/completion.go @@ -136,6 +136,10 @@ func runCompletionBash(out io.Writer, boilerPlate string, cmd *cobra.Command) er } func runCompletionZsh(out io.Writer, boilerPlate string, cmd *cobra.Command) error { + // Add zsh completion header to specifiy the command to complete for zsh + zshHead := fmt.Sprintf("#compdef %[1]s\ncompdef _%[1]s %[1]s\n", cmd.Name()) + out.Write([]byte(zshHead)) + if len(boilerPlate) == 0 { boilerPlate = defaultBoilerPlate }