mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-03 17:30:00 +00:00
Support completion for kubectl apply view/edit-last-applied
This commit is contained in:
parent
595ed7f613
commit
1989aa5023
@ -67,6 +67,8 @@ func NewViewLastAppliedOptions(out, err io.Writer) *ViewLastAppliedOptions {
|
|||||||
|
|
||||||
func NewCmdApplyViewLastApplied(f cmdutil.Factory, out, err io.Writer) *cobra.Command {
|
func NewCmdApplyViewLastApplied(f cmdutil.Factory, out, err io.Writer) *cobra.Command {
|
||||||
options := NewViewLastAppliedOptions(out, err)
|
options := NewViewLastAppliedOptions(out, err)
|
||||||
|
validArgs := cmdutil.ValidArgList(f)
|
||||||
|
|
||||||
cmd := &cobra.Command{
|
cmd := &cobra.Command{
|
||||||
Use: "view-last-applied (TYPE [NAME | -l label] | TYPE/NAME | -f FILENAME)",
|
Use: "view-last-applied (TYPE [NAME | -l label] | TYPE/NAME | -f FILENAME)",
|
||||||
DisableFlagsInUseLine: true,
|
DisableFlagsInUseLine: true,
|
||||||
@ -78,6 +80,8 @@ func NewCmdApplyViewLastApplied(f cmdutil.Factory, out, err io.Writer) *cobra.Co
|
|||||||
cmdutil.CheckErr(options.Validate(cmd))
|
cmdutil.CheckErr(options.Validate(cmd))
|
||||||
cmdutil.CheckErr(options.RunApplyViewLastApplied(cmd))
|
cmdutil.CheckErr(options.RunApplyViewLastApplied(cmd))
|
||||||
},
|
},
|
||||||
|
ValidArgs: validArgs,
|
||||||
|
ArgAliases: kubectl.ResourceAliases(validArgs),
|
||||||
}
|
}
|
||||||
|
|
||||||
cmd.Flags().StringVarP(&options.OutputFormat, "output", "o", options.OutputFormat, "Output format. Must be one of yaml|json")
|
cmd.Flags().StringVarP(&options.OutputFormat, "output", "o", options.OutputFormat, "Output format. Must be one of yaml|json")
|
||||||
|
@ -168,7 +168,8 @@ __kubectl_require_pod_and_container()
|
|||||||
__custom_func() {
|
__custom_func() {
|
||||||
case ${last_command} in
|
case ${last_command} in
|
||||||
kubectl_get | kubectl_describe | kubectl_delete | kubectl_label | kubectl_edit | kubectl_patch |\
|
kubectl_get | kubectl_describe | kubectl_delete | kubectl_label | kubectl_edit | kubectl_patch |\
|
||||||
kubectl_annotate | kubectl_expose | kubectl_scale | kubectl_autoscale | kubectl_taint | kubectl_rollout_*)
|
kubectl_annotate | kubectl_expose | kubectl_scale | kubectl_autoscale | kubectl_taint | kubectl_rollout_* |\
|
||||||
|
kubectl_apply_edit-last-applied | kubectl_apply_view-last-applied)
|
||||||
__kubectl_get_resource
|
__kubectl_get_resource
|
||||||
return
|
return
|
||||||
;;
|
;;
|
||||||
|
Loading…
Reference in New Issue
Block a user