mirror of
https://github.com/helm/helm.git
synced 2026-08-05 07:30:46 +00:00
feat(comp): Dynamic completion for --output flag (#6580)
Signed-off-by: Marc Khouzam <marc.khouzam@montreal.ca>
This commit is contained in:
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
|
||||
|
||||
Reference in New Issue
Block a user