diff --git a/ecs/cmd/commands/setup.go b/ecs/cmd/commands/setup.go index 7b93284f3..a4d55e612 100644 --- a/ecs/cmd/commands/setup.go +++ b/ecs/cmd/commands/setup.go @@ -42,7 +42,6 @@ func (s setupOptions) unsetRequiredArgs() []string { func SetupCommand() *cobra.Command { var opts setupOptions - var interactive bool cmd := &cobra.Command{ Use: "setup", @@ -53,16 +52,10 @@ func SetupCommand() *cobra.Command { return plugin.PersistentPreRunE(cmd, args) }, RunE: func(cmd *cobra.Command, args []string) error { - if interactive { + if requiredFlag := opts.unsetRequiredArgs(); len(requiredFlag) > 0 { if err := interactiveCli(&opts); err != nil { return err } - } else { - if requiredFlag := opts.unsetRequiredArgs(); len(requiredFlag) > 0 { - fmt.Printf("required flag(s) %q not set", requiredFlag) - cmd.Help() - os.Exit(1) - } } if opts.accessKeyID != "" && opts.secretAccessKey != "" { if err := saveCredentials(opts.context.Profile, opts.accessKeyID, opts.secretAccessKey); err != nil { @@ -78,7 +71,6 @@ func SetupCommand() *cobra.Command { cmd.Flags().StringVarP(&opts.context.Region, "region", "r", "", "AWS region") cmd.Flags().StringVarP(&opts.accessKeyID, "aws-key-id", "k", "", "AWS Access Key ID") cmd.Flags().StringVarP(&opts.secretAccessKey, "aws-secret-key", "s", "", "AWS Secret Access Key") - cmd.Flags().BoolVarP(&interactive, "interactive", "", false, "Interactively setup Context and Credentials") return cmd } diff --git a/ecs/tests/setup_command_test.go b/ecs/tests/setup_command_test.go index 104ba2294..a0cc9e46d 100644 --- a/ecs/tests/setup_command_test.go +++ b/ecs/tests/setup_command_test.go @@ -9,17 +9,6 @@ import ( "gotest.tools/v3/icmd" ) -func TestSetupMandatoryArguments(t *testing.T) { - cmd, cleanup := dockerCli.createTestCmd() - defer cleanup() - - cmd.Command = dockerCli.Command("ecs", "setup") - usage := icmd.RunCmd(cmd).Assert(t, icmd.Expected{ - ExitCode: 1, - }).Combined() - goldenFile := "setup-required-flags.golden" - golden.Assert(t, usage, goldenFile) -} func TestDefaultAwsContextName(t *testing.T) { cmd, cleanup := dockerCli.createTestCmd() defer cleanup() diff --git a/ecs/tests/testdata/setup-required-flags.golden b/ecs/tests/testdata/setup-required-flags.golden deleted file mode 100644 index 8666ef14f..000000000 --- a/ecs/tests/testdata/setup-required-flags.golden +++ /dev/null @@ -1,13 +0,0 @@ -required flag(s) ["profile" "cluster" "region"] not set -Usage: docker ecs setup - - - -Options: - -k, --aws-key-id string AWS Access Key ID - -s, --aws-secret-key string AWS Secret Access Key - -c, --cluster string ECS cluster - --interactive Interactively setup Context and Credentials - -n, --name string Context Name (default "aws") - -p, --profile string AWS Profile - -r, --region string AWS region