diff --git a/cli/command/container/create.go b/cli/command/container/create.go index 4f9a71091b..c3b870b2a2 100644 --- a/cli/command/container/create.go +++ b/cli/command/container/create.go @@ -43,7 +43,7 @@ type createOptions struct { // NewCreateCommand creates a new cobra.Command for `docker create` func NewCreateCommand(dockerCli command.Cli) *cobra.Command { - var opts createOptions + var options createOptions var copts *containerOptions cmd := &cobra.Command{ @@ -55,7 +55,7 @@ func NewCreateCommand(dockerCli command.Cli) *cobra.Command { if len(args) > 1 { copts.Args = args[1:] } - return runCreate(dockerCli, cmd.Flags(), &opts, copts) + return runCreate(dockerCli, cmd.Flags(), &options, copts) }, ValidArgsFunction: completion.ImageNames(dockerCli), } @@ -63,17 +63,16 @@ func NewCreateCommand(dockerCli command.Cli) *cobra.Command { flags := cmd.Flags() flags.SetInterspersed(false) - flags.StringVar(&opts.name, "name", "", "Assign a name to the container") - flags.StringVar(&opts.pull, "pull", PullImageMissing, - `Pull image before creating ("`+PullImageAlways+`"|"`+PullImageMissing+`"|"`+PullImageNever+`")`) - flags.BoolVarP(&opts.quiet, "quiet", "q", false, "Suppress the pull output") + flags.StringVar(&options.name, "name", "", "Assign a name to the container") + flags.StringVar(&options.pull, "pull", PullImageMissing, `Pull image before creating ("`+PullImageAlways+`"|"`+PullImageMissing+`"|"`+PullImageNever+`")`) + flags.BoolVarP(&options.quiet, "quiet", "q", false, "Suppress the pull output") // Add an explicit help that doesn't have a `-h` to prevent the conflict // with hostname flags.Bool("help", false, "Print usage") - command.AddPlatformFlag(flags, &opts.platform) - command.AddTrustVerificationFlags(flags, &opts.untrusted, dockerCli.ContentTrustEnabled()) + command.AddPlatformFlag(flags, &options.platform) + command.AddTrustVerificationFlags(flags, &options.untrusted, dockerCli.ContentTrustEnabled()) copts = addFlags(flags) return cmd } diff --git a/cli/command/container/run.go b/cli/command/container/run.go index d851709561..89ec06cd36 100644 --- a/cli/command/container/run.go +++ b/cli/command/container/run.go @@ -31,7 +31,7 @@ type runOptions struct { // NewRunCommand create a new `docker run` command func NewRunCommand(dockerCli command.Cli) *cobra.Command { - var opts runOptions + var options runOptions var copts *containerOptions cmd := &cobra.Command{ @@ -43,7 +43,7 @@ func NewRunCommand(dockerCli command.Cli) *cobra.Command { if len(args) > 1 { copts.Args = args[1:] } - return runRun(dockerCli, cmd.Flags(), &opts, copts) + return runRun(dockerCli, cmd.Flags(), &options, copts) }, ValidArgsFunction: completion.ImageNames(dockerCli), Annotations: map[string]string{ @@ -55,20 +55,19 @@ func NewRunCommand(dockerCli command.Cli) *cobra.Command { flags.SetInterspersed(false) // These are flags not stored in Config/HostConfig - flags.BoolVarP(&opts.detach, "detach", "d", false, "Run container in background and print container ID") - flags.BoolVar(&opts.sigProxy, "sig-proxy", true, "Proxy received signals to the process") - flags.StringVar(&opts.name, "name", "", "Assign a name to the container") - flags.StringVar(&opts.detachKeys, "detach-keys", "", "Override the key sequence for detaching a container") - flags.StringVar(&opts.createOptions.pull, "pull", PullImageMissing, - `Pull image before running ("`+PullImageAlways+`"|"`+PullImageMissing+`"|"`+PullImageNever+`")`) - flags.BoolVarP(&opts.createOptions.quiet, "quiet", "q", false, "Suppress the pull output") + flags.BoolVarP(&options.detach, "detach", "d", false, "Run container in background and print container ID") + flags.BoolVar(&options.sigProxy, "sig-proxy", true, "Proxy received signals to the process") + flags.StringVar(&options.name, "name", "", "Assign a name to the container") + flags.StringVar(&options.detachKeys, "detach-keys", "", "Override the key sequence for detaching a container") + flags.StringVar(&options.pull, "pull", PullImageMissing, `Pull image before running ("`+PullImageAlways+`"|"`+PullImageMissing+`"|"`+PullImageNever+`")`) + flags.BoolVarP(&options.quiet, "quiet", "q", false, "Suppress the pull output") // Add an explicit help that doesn't have a `-h` to prevent the conflict // with hostname flags.Bool("help", false, "Print usage") - command.AddPlatformFlag(flags, &opts.platform) - command.AddTrustVerificationFlags(flags, &opts.untrusted, dockerCli.ContentTrustEnabled()) + command.AddPlatformFlag(flags, &options.platform) + command.AddTrustVerificationFlags(flags, &options.untrusted, dockerCli.ContentTrustEnabled()) copts = addFlags(flags) cmd.RegisterFlagCompletionFunc(