From fa08e000cb25d8ea2de95366983cb62f041a041d Mon Sep 17 00:00:00 2001 From: Christophe Courtaut Date: Thu, 14 May 2020 17:55:52 +0200 Subject: [PATCH] Adds a no-descriptions flags for completions This allow to choose if descriptions in completions are generated for shells supporting it. Signed-off-by: Christophe Courtaut --- cmd/helm/completion.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cmd/helm/completion.go b/cmd/helm/completion.go index 0a921fc6d..faf00ff14 100644 --- a/cmd/helm/completion.go +++ b/cmd/helm/completion.go @@ -43,6 +43,7 @@ var ( "zsh": runCompletionZsh, "fish": runCompletionFish, } + completionNoDesc bool ) func newCompletionCmd(out io.Writer) *cobra.Command { @@ -60,6 +61,7 @@ func newCompletionCmd(out io.Writer) *cobra.Command { }, ValidArgs: shells, } + cmd.Flags().BoolVar(&completionNoDesc, "no-descriptions", false, "disable completion descriptions for shells that support it") return cmd } @@ -247,5 +249,5 @@ __helm_bash_source <(__helm_convert_bash_to_zsh) } func runCompletionFish(out io.Writer, cmd *cobra.Command) error { - return cmd.Root().GenFishCompletion(out, true) + return cmd.Root().GenFishCompletion(out, !completionNoDesc) }