feat(comp): Dynamic completion for --output flag (#6580)

Signed-off-by: Marc Khouzam <marc.khouzam@montreal.ca>
pull/6632/head
Marc Khouzam 5 years ago committed by Martin Hickey
parent 6cfd47784b
commit e2d5ec8397

@ -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

@ -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

Loading…
Cancel
Save