mirror of
https://github.com/helm/helm.git
synced 2026-04-03 16:15:46 -04:00
feat(comp): Dynamic completion for --output flag (#6580)
Signed-off-by: Marc Khouzam <marc.khouzam@montreal.ca>
This commit is contained in:
parent
6cfd47784b
commit
e2d5ec8397
2 changed files with 8 additions and 0 deletions
|
|
@ -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…
Reference in a new issue