mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-03 09:22:44 +00:00
Enable kubectl label resource type bash completion
This commit is contained in:
parent
64717962cf
commit
23740d9080
@ -833,6 +833,21 @@ _kubectl_label()
|
|||||||
|
|
||||||
must_have_one_flag=()
|
must_have_one_flag=()
|
||||||
must_have_one_noun=()
|
must_have_one_noun=()
|
||||||
|
must_have_one_noun+=("componentstatus")
|
||||||
|
must_have_one_noun+=("endpoints")
|
||||||
|
must_have_one_noun+=("event")
|
||||||
|
must_have_one_noun+=("limitrange")
|
||||||
|
must_have_one_noun+=("namespace")
|
||||||
|
must_have_one_noun+=("node")
|
||||||
|
must_have_one_noun+=("persistentvolume")
|
||||||
|
must_have_one_noun+=("persistentvolumeclaim")
|
||||||
|
must_have_one_noun+=("pod")
|
||||||
|
must_have_one_noun+=("podtemplate")
|
||||||
|
must_have_one_noun+=("replicationcontroller")
|
||||||
|
must_have_one_noun+=("resourcequota")
|
||||||
|
must_have_one_noun+=("secret")
|
||||||
|
must_have_one_noun+=("service")
|
||||||
|
must_have_one_noun+=("serviceaccount")
|
||||||
}
|
}
|
||||||
|
|
||||||
_kubectl_annotate()
|
_kubectl_annotate()
|
||||||
|
@ -64,6 +64,8 @@ $ kubectl label pods foo bar-`
|
|||||||
|
|
||||||
func NewCmdLabel(f *cmdutil.Factory, out io.Writer) *cobra.Command {
|
func NewCmdLabel(f *cmdutil.Factory, out io.Writer) *cobra.Command {
|
||||||
options := &LabelOptions{}
|
options := &LabelOptions{}
|
||||||
|
p := kubectl.NewHumanReadablePrinter(false, false, false, false, []string{})
|
||||||
|
validArgs := p.HandledResources()
|
||||||
|
|
||||||
cmd := &cobra.Command{
|
cmd := &cobra.Command{
|
||||||
Use: "label [--overwrite] (-f FILENAME | TYPE NAME) KEY_1=VAL_1 ... KEY_N=VAL_N [--resource-version=version]",
|
Use: "label [--overwrite] (-f FILENAME | TYPE NAME) KEY_1=VAL_1 ... KEY_N=VAL_N [--resource-version=version]",
|
||||||
@ -74,6 +76,7 @@ func NewCmdLabel(f *cmdutil.Factory, out io.Writer) *cobra.Command {
|
|||||||
err := RunLabel(f, out, cmd, args, options)
|
err := RunLabel(f, out, cmd, args, options)
|
||||||
cmdutil.CheckErr(err)
|
cmdutil.CheckErr(err)
|
||||||
},
|
},
|
||||||
|
ValidArgs: validArgs,
|
||||||
}
|
}
|
||||||
cmdutil.AddPrinterFlags(cmd)
|
cmdutil.AddPrinterFlags(cmd)
|
||||||
cmd.Flags().Bool("overwrite", false, "If true, allow labels to be overwritten, otherwise reject label updates that overwrite existing labels.")
|
cmd.Flags().Bool("overwrite", false, "If true, allow labels to be overwritten, otherwise reject label updates that overwrite existing labels.")
|
||||||
|
Loading…
Reference in New Issue
Block a user