Skip to content

Commit

Permalink
Merge pull request kubernetes#124592 from ah8ad3/add-kubectl-set-comp…
Browse files Browse the repository at this point in the history
…letion

Add completion for kubectl set image
  • Loading branch information
k8s-ci-robot authored May 7, 2024
2 parents 1dc30bf + ee58214 commit 0590bb1
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions staging/src/k8s.io/kubectl/pkg/cmd/set/set_image.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import (
cmdutil "k8s.io/kubectl/pkg/cmd/util"
"k8s.io/kubectl/pkg/polymorphichelpers"
"k8s.io/kubectl/pkg/scheme"
"k8s.io/kubectl/pkg/util/completion"
"k8s.io/kubectl/pkg/util/i18n"
"k8s.io/kubectl/pkg/util/templates"
)
Expand Down Expand Up @@ -112,13 +113,15 @@ func NewImageOptions(streams genericiooptions.IOStreams) *SetImageOptions {
// NewCmdImage returns an initialized Command instance for the 'set image' sub command
func NewCmdImage(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command {
o := NewImageOptions(streams)
validArgs := []string{"daemonsets", "deployments", "pods", "cronjobs", "replicasets", "replicationcontrollers", "statefulsets"}

cmd := &cobra.Command{
Use: "image (-f FILENAME | TYPE NAME) CONTAINER_NAME_1=CONTAINER_IMAGE_1 ... CONTAINER_NAME_N=CONTAINER_IMAGE_N",
DisableFlagsInUseLine: true,
Short: i18n.T("Update the image of a pod template"),
Long: imageLong,
Example: imageExample,
ValidArgsFunction: completion.SpecifiedResourceTypeAndNameNoRepeatCompletionFunc(f, validArgs),
Run: func(cmd *cobra.Command, args []string) {
cmdutil.CheckErr(o.Complete(f, cmd, args))
cmdutil.CheckErr(o.Validate())
Expand Down

0 comments on commit 0590bb1

Please sign in to comment.