diff --git a/cmd/helm/completion.go b/cmd/helm/completion.go index c1f7790bc..0a921fc6d 100644 --- a/cmd/helm/completion.go +++ b/cmd/helm/completion.go @@ -26,7 +26,7 @@ import ( ) const completionDesc = ` -Generate autocompletions script for Helm for the specified shell (bash or zsh). +Generate autocompletions script for Helm for the specified shell (bash, zsh or fish). This command can generate shell autocompletions. e.g. @@ -41,6 +41,7 @@ var ( completionShells = map[string]func(out io.Writer, cmd *cobra.Command) error{ "bash": runCompletionBash, "zsh": runCompletionZsh, + "fish": runCompletionFish, } ) @@ -52,7 +53,7 @@ func newCompletionCmd(out io.Writer) *cobra.Command { cmd := &cobra.Command{ Use: "completion SHELL", - Short: "generate autocompletions script for the specified shell (bash or zsh)", + Short: "generate autocompletions script for the specified shell (bash, zsh or fish)", Long: completionDesc, RunE: func(cmd *cobra.Command, args []string) error { return runCompletion(out, cmd, args) @@ -244,3 +245,7 @@ __helm_bash_source <(__helm_convert_bash_to_zsh) out.Write([]byte(zshTail)) return nil } + +func runCompletionFish(out io.Writer, cmd *cobra.Command) error { + return cmd.Root().GenFishCompletion(out, true) +}