mirror of https://github.com/docker/cli.git
improve semantics of utility function in cli/command/service
Signed-off-by: Gaetan de Villele <gdevillele@gmail.com>
This commit is contained in:
parent
69b7bf5e9f
commit
59c79325bc
|
@ -29,7 +29,7 @@ func newCreateCommand(dockerCli *command.DockerCli) *cobra.Command {
|
|||
flags.StringVar(&opts.mode, flagMode, "replicated", "Service mode (replicated or global)")
|
||||
flags.StringVar(&opts.name, flagName, "", "Service name")
|
||||
|
||||
addServiceFlags(cmd, opts)
|
||||
addServiceFlags(flags, opts)
|
||||
|
||||
flags.VarP(&opts.labels, flagLabel, "l", "Service labels")
|
||||
flags.Var(&opts.containerLabels, flagContainerLabel, "Container labels")
|
||||
|
|
|
@ -11,7 +11,7 @@ import (
|
|||
"github.com/docker/docker/api/types/swarm"
|
||||
"github.com/docker/docker/opts"
|
||||
runconfigopts "github.com/docker/docker/runconfig/opts"
|
||||
"github.com/spf13/cobra"
|
||||
"github.com/spf13/pflag"
|
||||
)
|
||||
|
||||
type int64Value interface {
|
||||
|
@ -468,9 +468,7 @@ func (opts *serviceOptions) ToService() (swarm.ServiceSpec, error) {
|
|||
|
||||
// addServiceFlags adds all flags that are common to both `create` and `update`.
|
||||
// Any flags that are not common are added separately in the individual command
|
||||
func addServiceFlags(cmd *cobra.Command, opts *serviceOptions) {
|
||||
flags := cmd.Flags()
|
||||
|
||||
func addServiceFlags(flags *pflag.FlagSet, opts *serviceOptions) {
|
||||
flags.StringVarP(&opts.workdir, flagWorkdir, "w", "", "Working directory inside the container")
|
||||
flags.StringVarP(&opts.user, flagUser, "u", "", "Username or UID (format: <name|uid>[:<group|gid>])")
|
||||
flags.StringVar(&opts.hostname, flagHostname, "", "Container hostname")
|
||||
|
|
|
@ -43,7 +43,7 @@ func newUpdateCommand(dockerCli *command.DockerCli) *cobra.Command {
|
|||
flags.SetAnnotation("rollback", "version", []string{"1.25"})
|
||||
flags.Bool("force", false, "Force update even if no changes require it")
|
||||
flags.SetAnnotation("force", "version", []string{"1.25"})
|
||||
addServiceFlags(cmd, serviceOpts)
|
||||
addServiceFlags(flags, serviceOpts)
|
||||
|
||||
flags.Var(newListOptsVar(), flagEnvRemove, "Remove an environment variable")
|
||||
flags.Var(newListOptsVar(), flagGroupRemove, "Remove a previously added supplementary user group from the container")
|
||||
|
|
Loading…
Reference in New Issue