mirror of https://github.com/docker/cli.git
Merge pull request #3691 from thaJeztah/fix_conflicting_names
cli/command/container: rename variable that collided with import
This commit is contained in:
commit
8403f06629
|
@ -43,7 +43,7 @@ type createOptions struct {
|
||||||
|
|
||||||
// NewCreateCommand creates a new cobra.Command for `docker create`
|
// NewCreateCommand creates a new cobra.Command for `docker create`
|
||||||
func NewCreateCommand(dockerCli command.Cli) *cobra.Command {
|
func NewCreateCommand(dockerCli command.Cli) *cobra.Command {
|
||||||
var opts createOptions
|
var options createOptions
|
||||||
var copts *containerOptions
|
var copts *containerOptions
|
||||||
|
|
||||||
cmd := &cobra.Command{
|
cmd := &cobra.Command{
|
||||||
|
@ -55,7 +55,7 @@ func NewCreateCommand(dockerCli command.Cli) *cobra.Command {
|
||||||
if len(args) > 1 {
|
if len(args) > 1 {
|
||||||
copts.Args = args[1:]
|
copts.Args = args[1:]
|
||||||
}
|
}
|
||||||
return runCreate(dockerCli, cmd.Flags(), &opts, copts)
|
return runCreate(dockerCli, cmd.Flags(), &options, copts)
|
||||||
},
|
},
|
||||||
ValidArgsFunction: completion.ImageNames(dockerCli),
|
ValidArgsFunction: completion.ImageNames(dockerCli),
|
||||||
}
|
}
|
||||||
|
@ -63,17 +63,16 @@ func NewCreateCommand(dockerCli command.Cli) *cobra.Command {
|
||||||
flags := cmd.Flags()
|
flags := cmd.Flags()
|
||||||
flags.SetInterspersed(false)
|
flags.SetInterspersed(false)
|
||||||
|
|
||||||
flags.StringVar(&opts.name, "name", "", "Assign a name to the container")
|
flags.StringVar(&options.name, "name", "", "Assign a name to the container")
|
||||||
flags.StringVar(&opts.pull, "pull", PullImageMissing,
|
flags.StringVar(&options.pull, "pull", PullImageMissing, `Pull image before creating ("`+PullImageAlways+`"|"`+PullImageMissing+`"|"`+PullImageNever+`")`)
|
||||||
`Pull image before creating ("`+PullImageAlways+`"|"`+PullImageMissing+`"|"`+PullImageNever+`")`)
|
flags.BoolVarP(&options.quiet, "quiet", "q", false, "Suppress the pull output")
|
||||||
flags.BoolVarP(&opts.quiet, "quiet", "q", false, "Suppress the pull output")
|
|
||||||
|
|
||||||
// Add an explicit help that doesn't have a `-h` to prevent the conflict
|
// Add an explicit help that doesn't have a `-h` to prevent the conflict
|
||||||
// with hostname
|
// with hostname
|
||||||
flags.Bool("help", false, "Print usage")
|
flags.Bool("help", false, "Print usage")
|
||||||
|
|
||||||
command.AddPlatformFlag(flags, &opts.platform)
|
command.AddPlatformFlag(flags, &options.platform)
|
||||||
command.AddTrustVerificationFlags(flags, &opts.untrusted, dockerCli.ContentTrustEnabled())
|
command.AddTrustVerificationFlags(flags, &options.untrusted, dockerCli.ContentTrustEnabled())
|
||||||
copts = addFlags(flags)
|
copts = addFlags(flags)
|
||||||
return cmd
|
return cmd
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,7 +31,7 @@ type runOptions struct {
|
||||||
|
|
||||||
// NewRunCommand create a new `docker run` command
|
// NewRunCommand create a new `docker run` command
|
||||||
func NewRunCommand(dockerCli command.Cli) *cobra.Command {
|
func NewRunCommand(dockerCli command.Cli) *cobra.Command {
|
||||||
var opts runOptions
|
var options runOptions
|
||||||
var copts *containerOptions
|
var copts *containerOptions
|
||||||
|
|
||||||
cmd := &cobra.Command{
|
cmd := &cobra.Command{
|
||||||
|
@ -43,7 +43,7 @@ func NewRunCommand(dockerCli command.Cli) *cobra.Command {
|
||||||
if len(args) > 1 {
|
if len(args) > 1 {
|
||||||
copts.Args = args[1:]
|
copts.Args = args[1:]
|
||||||
}
|
}
|
||||||
return runRun(dockerCli, cmd.Flags(), &opts, copts)
|
return runRun(dockerCli, cmd.Flags(), &options, copts)
|
||||||
},
|
},
|
||||||
ValidArgsFunction: completion.ImageNames(dockerCli),
|
ValidArgsFunction: completion.ImageNames(dockerCli),
|
||||||
Annotations: map[string]string{
|
Annotations: map[string]string{
|
||||||
|
@ -55,20 +55,19 @@ func NewRunCommand(dockerCli command.Cli) *cobra.Command {
|
||||||
flags.SetInterspersed(false)
|
flags.SetInterspersed(false)
|
||||||
|
|
||||||
// These are flags not stored in Config/HostConfig
|
// These are flags not stored in Config/HostConfig
|
||||||
flags.BoolVarP(&opts.detach, "detach", "d", false, "Run container in background and print container ID")
|
flags.BoolVarP(&options.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.BoolVar(&options.sigProxy, "sig-proxy", true, "Proxy received signals to the process")
|
||||||
flags.StringVar(&opts.name, "name", "", "Assign a name to the container")
|
flags.StringVar(&options.name, "name", "", "Assign a name to the container")
|
||||||
flags.StringVar(&opts.detachKeys, "detach-keys", "", "Override the key sequence for detaching a container")
|
flags.StringVar(&options.detachKeys, "detach-keys", "", "Override the key sequence for detaching a container")
|
||||||
flags.StringVar(&opts.createOptions.pull, "pull", PullImageMissing,
|
flags.StringVar(&options.pull, "pull", PullImageMissing, `Pull image before running ("`+PullImageAlways+`"|"`+PullImageMissing+`"|"`+PullImageNever+`")`)
|
||||||
`Pull image before running ("`+PullImageAlways+`"|"`+PullImageMissing+`"|"`+PullImageNever+`")`)
|
flags.BoolVarP(&options.quiet, "quiet", "q", false, "Suppress the pull output")
|
||||||
flags.BoolVarP(&opts.createOptions.quiet, "quiet", "q", false, "Suppress the pull output")
|
|
||||||
|
|
||||||
// Add an explicit help that doesn't have a `-h` to prevent the conflict
|
// Add an explicit help that doesn't have a `-h` to prevent the conflict
|
||||||
// with hostname
|
// with hostname
|
||||||
flags.Bool("help", false, "Print usage")
|
flags.Bool("help", false, "Print usage")
|
||||||
|
|
||||||
command.AddPlatformFlag(flags, &opts.platform)
|
command.AddPlatformFlag(flags, &options.platform)
|
||||||
command.AddTrustVerificationFlags(flags, &opts.untrusted, dockerCli.ContentTrustEnabled())
|
command.AddTrustVerificationFlags(flags, &options.untrusted, dockerCli.ContentTrustEnabled())
|
||||||
copts = addFlags(flags)
|
copts = addFlags(flags)
|
||||||
|
|
||||||
cmd.RegisterFlagCompletionFunc(
|
cmd.RegisterFlagCompletionFunc(
|
||||||
|
|
Loading…
Reference in New Issue