diff --git a/pkg/kubectl-argo-rollouts/cmd/abort/abort.go b/pkg/kubectl-argo-rollouts/cmd/abort/abort.go index f90062abc8..f946faf74f 100644 --- a/pkg/kubectl-argo-rollouts/cmd/abort/abort.go +++ b/pkg/kubectl-argo-rollouts/cmd/abort/abort.go @@ -12,6 +12,7 @@ import ( "github.com/argoproj/argo-rollouts/pkg/apis/rollouts/v1alpha1" clientset "github.com/argoproj/argo-rollouts/pkg/client/clientset/versioned/typed/rollouts/v1alpha1" "github.com/argoproj/argo-rollouts/pkg/kubectl-argo-rollouts/options" + completionutil "github.com/argoproj/argo-rollouts/pkg/kubectl-argo-rollouts/util/completion" ) const ( @@ -52,6 +53,7 @@ func NewCmdAbort(o *options.ArgoRolloutsOptions) *cobra.Command { } return nil }, + ValidArgsFunction: completionutil.RolloutNameCompletionFunc(o), } return cmd } diff --git a/pkg/kubectl-argo-rollouts/cmd/pause/pause.go b/pkg/kubectl-argo-rollouts/cmd/pause/pause.go index 2b83759d1f..9a5e6b3903 100644 --- a/pkg/kubectl-argo-rollouts/cmd/pause/pause.go +++ b/pkg/kubectl-argo-rollouts/cmd/pause/pause.go @@ -9,6 +9,7 @@ import ( types "k8s.io/apimachinery/pkg/types" "github.com/argoproj/argo-rollouts/pkg/kubectl-argo-rollouts/options" + completionutil "github.com/argoproj/argo-rollouts/pkg/kubectl-argo-rollouts/util/completion" ) const ( @@ -40,6 +41,7 @@ func NewCmdPause(o *options.ArgoRolloutsOptions) *cobra.Command { } return nil }, + ValidArgsFunction: completionutil.RolloutNameCompletionFunc(o), } return cmd } diff --git a/pkg/kubectl-argo-rollouts/cmd/promote/promote.go b/pkg/kubectl-argo-rollouts/cmd/promote/promote.go index 0ad90d4654..d71d68573f 100644 --- a/pkg/kubectl-argo-rollouts/cmd/promote/promote.go +++ b/pkg/kubectl-argo-rollouts/cmd/promote/promote.go @@ -12,6 +12,7 @@ import ( "github.com/argoproj/argo-rollouts/pkg/apis/rollouts/v1alpha1" clientset "github.com/argoproj/argo-rollouts/pkg/client/clientset/versioned/typed/rollouts/v1alpha1" "github.com/argoproj/argo-rollouts/pkg/kubectl-argo-rollouts/options" + completionutil "github.com/argoproj/argo-rollouts/pkg/kubectl-argo-rollouts/util/completion" replicasetutil "github.com/argoproj/argo-rollouts/utils/replicaset" ) @@ -77,6 +78,7 @@ func NewCmdPromote(o *options.ArgoRolloutsOptions) *cobra.Command { return nil }, + ValidArgsFunction: completionutil.RolloutNameCompletionFunc(o), } cmd.Flags().BoolVarP(&skipCurrentStep, "skip-current-step", "c", false, "Skip currently running canary step") cmd.Flags().BoolVarP(&skipAllSteps, "skip-all-steps", "a", false, "Skip remaining steps") diff --git a/pkg/kubectl-argo-rollouts/cmd/restart/restart.go b/pkg/kubectl-argo-rollouts/cmd/restart/restart.go index c99ac12009..5864879d36 100644 --- a/pkg/kubectl-argo-rollouts/cmd/restart/restart.go +++ b/pkg/kubectl-argo-rollouts/cmd/restart/restart.go @@ -12,6 +12,7 @@ import ( "github.com/argoproj/argo-rollouts/pkg/apis/rollouts/v1alpha1" clientset "github.com/argoproj/argo-rollouts/pkg/client/clientset/versioned/typed/rollouts/v1alpha1" "github.com/argoproj/argo-rollouts/pkg/kubectl-argo-rollouts/options" + completionutil "github.com/argoproj/argo-rollouts/pkg/kubectl-argo-rollouts/util/completion" timeutil "github.com/argoproj/argo-rollouts/utils/time" ) @@ -62,6 +63,7 @@ func NewCmdRestart(o *options.ArgoRolloutsOptions) *cobra.Command { fmt.Fprintf(o.Out, "rollout '%s' restarts in %s\n", ro.Name, in) return nil }, + ValidArgsFunction: completionutil.RolloutNameCompletionFunc(o), } cmd.Flags().StringVarP(&in, "in", "i", "", "Amount of time before a restart. (e.g. 30s, 5m, 1h)") return cmd diff --git a/pkg/kubectl-argo-rollouts/cmd/retry/retry.go b/pkg/kubectl-argo-rollouts/cmd/retry/retry.go index e5d74a3733..93b3c6f885 100644 --- a/pkg/kubectl-argo-rollouts/cmd/retry/retry.go +++ b/pkg/kubectl-argo-rollouts/cmd/retry/retry.go @@ -12,6 +12,7 @@ import ( "github.com/argoproj/argo-rollouts/pkg/apis/rollouts/v1alpha1" clientset "github.com/argoproj/argo-rollouts/pkg/client/clientset/versioned/typed/rollouts/v1alpha1" "github.com/argoproj/argo-rollouts/pkg/kubectl-argo-rollouts/options" + completionutil "github.com/argoproj/argo-rollouts/pkg/kubectl-argo-rollouts/util/completion" ) const ( @@ -76,6 +77,7 @@ func NewCmdRetryRollout(o *options.ArgoRolloutsOptions) *cobra.Command { } return nil }, + ValidArgsFunction: completionutil.RolloutNameCompletionFunc(o), } return cmd } diff --git a/pkg/kubectl-argo-rollouts/cmd/set/set_image.go b/pkg/kubectl-argo-rollouts/cmd/set/set_image.go index c1a66c935c..45ed6faac9 100644 --- a/pkg/kubectl-argo-rollouts/cmd/set/set_image.go +++ b/pkg/kubectl-argo-rollouts/cmd/set/set_image.go @@ -14,6 +14,7 @@ import ( "github.com/argoproj/argo-rollouts/pkg/apis/rollouts/v1alpha1" "github.com/argoproj/argo-rollouts/pkg/kubectl-argo-rollouts/options" + completionutil "github.com/argoproj/argo-rollouts/pkg/kubectl-argo-rollouts/util/completion" ) const ( @@ -60,6 +61,7 @@ func NewCmdSetImage(o *options.ArgoRolloutsOptions) *cobra.Command { fmt.Fprintf(o.Out, "%s \"%s\" image updated\n", strings.ToLower(un.GetKind()), un.GetName()) return nil }, + ValidArgsFunction: completionutil.RolloutNameCompletionFunc(o), } return cmd } diff --git a/pkg/kubectl-argo-rollouts/cmd/status/status.go b/pkg/kubectl-argo-rollouts/cmd/status/status.go index 826debb207..79d7272d88 100644 --- a/pkg/kubectl-argo-rollouts/cmd/status/status.go +++ b/pkg/kubectl-argo-rollouts/cmd/status/status.go @@ -8,6 +8,7 @@ import ( "github.com/argoproj/argo-rollouts/pkg/apiclient/rollout" "github.com/argoproj/argo-rollouts/pkg/kubectl-argo-rollouts/cmd/signals" "github.com/argoproj/argo-rollouts/pkg/kubectl-argo-rollouts/options" + completionutil "github.com/argoproj/argo-rollouts/pkg/kubectl-argo-rollouts/util/completion" "github.com/argoproj/argo-rollouts/pkg/kubectl-argo-rollouts/viewcontroller" "github.com/spf13/cobra" ) @@ -89,6 +90,7 @@ func NewCmdStatus(o *options.ArgoRolloutsOptions) *cobra.Command { return nil }, + ValidArgsFunction: completionutil.RolloutNameCompletionFunc(o), } cmd.Flags().BoolVarP(&statusOptions.Watch, "watch", "w", true, "Watch the status of the rollout until it's done") cmd.Flags().DurationVarP(&statusOptions.Timeout, "timeout", "t", time.Duration(0), "The length of time to watch before giving up. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). Zero means wait forever") diff --git a/pkg/kubectl-argo-rollouts/cmd/undo/undo.go b/pkg/kubectl-argo-rollouts/cmd/undo/undo.go index 58bfe11b7c..a282757b16 100644 --- a/pkg/kubectl-argo-rollouts/cmd/undo/undo.go +++ b/pkg/kubectl-argo-rollouts/cmd/undo/undo.go @@ -17,6 +17,7 @@ import ( "github.com/argoproj/argo-rollouts/pkg/apis/rollouts/v1alpha1" "github.com/argoproj/argo-rollouts/pkg/kubectl-argo-rollouts/options" + completionutil "github.com/argoproj/argo-rollouts/pkg/kubectl-argo-rollouts/util/completion" routils "github.com/argoproj/argo-rollouts/utils/unstructured" appsv1 "k8s.io/api/apps/v1" corev1 "k8s.io/api/core/v1" @@ -60,6 +61,7 @@ func NewCmdUndo(o *options.ArgoRolloutsOptions) *cobra.Command { fmt.Fprintf(o.Out, result) return nil }, + ValidArgsFunction: completionutil.RolloutNameCompletionFunc(o), } cmd.Flags().Int64Var(&toRevision, "to-revision", toRevision, "The revision to rollback to. Default to 0 (last revision).") return cmd