diff --git a/cmd/helm/flags.go b/cmd/helm/flags.go index 09676e658..32d5b891b 100644 --- a/cmd/helm/flags.go +++ b/cmd/helm/flags.go @@ -52,6 +52,8 @@ func addChartPathOptionsFlags(f *pflag.FlagSet, c *action.ChartPathOptions) { // value to the given format pointer func bindOutputFlag(cmd *cobra.Command, varRef *output.Format) { cmd.Flags().VarP(newOutputValue(output.Table, varRef), outputFlag, "o", fmt.Sprintf("prints the output in the specified format. Allowed values: %s, %s, %s", output.Table, output.JSON, output.YAML)) + // Setup shell completion for the flag + cmd.MarkFlagCustom(outputFlag, "__helm_output_options") } type outputValue output.Format diff --git a/cmd/helm/root.go b/cmd/helm/root.go index eccb49fa0..e28e8bdfb 100644 --- a/cmd/helm/root.go +++ b/cmd/helm/root.go @@ -89,6 +89,12 @@ __helm_get_namespaces() fi } +__helm_output_options() +{ + __helm_debug "${FUNCNAME[0]}: c is $c words[c] is ${words[c]}" + COMPREPLY+=( $( compgen -W "table json yaml" -- "$cur" ) ) +} + __helm_binary_name() { local helm_binary