From 4595ce588cd19879a33f32150c33a6bc3571b0a8 Mon Sep 17 00:00:00 2001 From: CrazyMax Date: Tue, 3 Jan 2023 11:12:24 +0100 Subject: [PATCH] cmd: set double quotes as code delimiter Signed-off-by: CrazyMax --- cli/cobra.go | 5 ++++- cli/command/builder/prune.go | 2 +- cli/command/container/commit.go | 2 +- cli/command/container/create.go | 2 +- cli/command/container/exec.go | 2 +- cli/command/container/logs.go | 4 ++-- cli/command/container/prune.go | 2 +- cli/command/container/run.go | 2 +- cli/command/container/update.go | 6 +++--- cli/command/context/create.go | 2 +- cli/command/image/build.go | 10 +++++----- cli/command/image/prune.go | 2 +- cli/command/network/connect.go | 4 ++-- cli/command/network/list.go | 2 +- cli/command/network/prune.go | 2 +- cli/command/node/update.go | 6 +++--- cli/command/plugin/list.go | 2 +- cli/command/service/create.go | 2 +- cli/command/service/logs.go | 2 +- cli/command/service/opts.go | 10 +++++----- cli/command/service/update.go | 4 ++-- cli/command/stack/deploy.go | 2 +- cli/command/swarm/init.go | 8 ++++---- cli/command/swarm/join.go | 8 ++++---- cli/command/system/prune.go | 2 +- cli/command/volume/create.go | 8 ++++---- cli/command/volume/list.go | 2 +- cli/command/volume/prune.go | 2 +- cli/command/volume/update.go | 2 +- cli/flags/options.go | 2 +- e2e/stack/testdata/stack-deploy-help.golden | 4 ++-- 31 files changed, 59 insertions(+), 56 deletions(-) diff --git a/cli/cobra.go b/cli/cobra.go index dbb6caa82b..0341f075d2 100644 --- a/cli/cobra.go +++ b/cli/cobra.go @@ -61,7 +61,10 @@ func setupCommonRootCommand(rootCmd *cobra.Command) (*cliflags.ClientOptions, *p rootCmd.PersistentFlags().MarkShorthandDeprecated("help", "please use --help") rootCmd.PersistentFlags().Lookup("help").Hidden = true - rootCmd.Annotations = map[string]string{"additionalHelp": "For more help on how to use Docker, head to https://docs.docker.com/go/guides/"} + rootCmd.Annotations = map[string]string{ + "additionalHelp": "For more help on how to use Docker, head to https://docs.docker.com/go/guides/", + "docs.code-delimiter": `"`, // https://github.com/docker/cli-docs-tool/blob/77abede22166eaea4af7335096bdcedd043f5b19/annotation/annotation.go#L20-L22 + } // Configure registry.CertsDir() when running in rootless-mode if os.Getenv("ROOTLESSKIT_STATE_DIR") != "" { diff --git a/cli/command/builder/prune.go b/cli/command/builder/prune.go index e814368cb8..30215601ed 100644 --- a/cli/command/builder/prune.go +++ b/cli/command/builder/prune.go @@ -47,7 +47,7 @@ func NewPruneCommand(dockerCli command.Cli) *cobra.Command { flags := cmd.Flags() flags.BoolVarP(&options.force, "force", "f", false, "Do not prompt for confirmation") flags.BoolVarP(&options.all, "all", "a", false, "Remove all unused build cache, not just dangling ones") - flags.Var(&options.filter, "filter", "Provide filter values (e.g. 'until=24h')") + flags.Var(&options.filter, "filter", `Provide filter values (e.g. "until=24h")`) flags.Var(&options.keepStorage, "keep-storage", "Amount of disk space to keep for cache") return cmd diff --git a/cli/command/container/commit.go b/cli/command/container/commit.go index 70ec4d2d9b..39b8db9a5f 100644 --- a/cli/command/container/commit.go +++ b/cli/command/container/commit.go @@ -48,7 +48,7 @@ func NewCommitCommand(dockerCli command.Cli) *cobra.Command { flags.BoolVarP(&options.pause, "pause", "p", true, "Pause container during commit") flags.StringVarP(&options.comment, "message", "m", "", "Commit message") - flags.StringVarP(&options.author, "author", "a", "", "Author (e.g., \"John Hannibal Smith \")") + flags.StringVarP(&options.author, "author", "a", "", `Author (e.g., "John Hannibal Smith ")`) options.changes = opts.NewListOpts(nil) flags.VarP(&options.changes, "change", "c", "Apply Dockerfile instruction to the created image") diff --git a/cli/command/container/create.go b/cli/command/container/create.go index a3e8dd09ac..c5aa71ae29 100644 --- a/cli/command/container/create.go +++ b/cli/command/container/create.go @@ -67,7 +67,7 @@ func NewCreateCommand(dockerCli command.Cli) *cobra.Command { flags.SetInterspersed(false) 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.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 diff --git a/cli/command/container/exec.go b/cli/command/container/exec.go index 521f294ed7..3160aaba83 100644 --- a/cli/command/container/exec.go +++ b/cli/command/container/exec.go @@ -70,7 +70,7 @@ func NewExecCommand(dockerCli command.Cli) *cobra.Command { flags.BoolVarP(&options.Interactive, "interactive", "i", false, "Keep STDIN open even if not attached") flags.BoolVarP(&options.TTY, "tty", "t", false, "Allocate a pseudo-TTY") flags.BoolVarP(&options.Detach, "detach", "d", false, "Detached mode: run command in the background") - flags.StringVarP(&options.User, "user", "u", "", "Username or UID (format: [:])") + flags.StringVarP(&options.User, "user", "u", "", `Username or UID (format: "[:]")`) flags.BoolVarP(&options.Privileged, "privileged", "", false, "Give extended privileges to the command") flags.VarP(&options.Env, "env", "e", "Set environment variables") flags.SetAnnotation("env", "version", []string{"1.25"}) diff --git a/cli/command/container/logs.go b/cli/command/container/logs.go index c58023f590..0fd7cfd0cc 100644 --- a/cli/command/container/logs.go +++ b/cli/command/container/logs.go @@ -43,8 +43,8 @@ func NewLogsCommand(dockerCli command.Cli) *cobra.Command { flags := cmd.Flags() flags.BoolVarP(&opts.follow, "follow", "f", false, "Follow log output") - flags.StringVar(&opts.since, "since", "", "Show logs since timestamp (e.g. 2013-01-02T13:23:37Z) or relative (e.g. 42m for 42 minutes)") - flags.StringVar(&opts.until, "until", "", "Show logs before a timestamp (e.g. 2013-01-02T13:23:37Z) or relative (e.g. 42m for 42 minutes)") + flags.StringVar(&opts.since, "since", "", `Show logs since timestamp (e.g. "2013-01-02T13:23:37Z") or relative (e.g. "42m" for 42 minutes)`) + flags.StringVar(&opts.until, "until", "", `Show logs before a timestamp (e.g. "2013-01-02T13:23:37Z") or relative (e.g. "42m" for 42 minutes)`) flags.SetAnnotation("until", "version", []string{"1.35"}) flags.BoolVarP(&opts.timestamps, "timestamps", "t", false, "Show timestamps") flags.BoolVar(&opts.details, "details", false, "Show extra details provided to logs") diff --git a/cli/command/container/prune.go b/cli/command/container/prune.go index 69b30269fc..225ab5f2d2 100644 --- a/cli/command/container/prune.go +++ b/cli/command/container/prune.go @@ -42,7 +42,7 @@ func NewPruneCommand(dockerCli command.Cli) *cobra.Command { flags := cmd.Flags() flags.BoolVarP(&options.force, "force", "f", false, "Do not prompt for confirmation") - flags.Var(&options.filter, "filter", "Provide filter values (e.g. 'until=')") + flags.Var(&options.filter, "filter", `Provide filter values (e.g. "until=")`) return cmd } diff --git a/cli/command/container/run.go b/cli/command/container/run.go index 5cdcffc23d..dcf9dca9f2 100644 --- a/cli/command/container/run.go +++ b/cli/command/container/run.go @@ -60,7 +60,7 @@ func NewRunCommand(dockerCli command.Cli) *cobra.Command { 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.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 diff --git a/cli/command/container/update.go b/cli/command/container/update.go index fbef531bcf..0e53ceb9df 100644 --- a/cli/command/container/update.go +++ b/cli/command/container/update.go @@ -56,7 +56,7 @@ func NewUpdateCommand(dockerCli command.Cli) *cobra.Command { } flags := cmd.Flags() - flags.Uint16Var(&options.blkioWeight, "blkio-weight", 0, "Block IO (relative weight), between 10 and 1000, or 0 to disable (default 0)") + flags.Uint16Var(&options.blkioWeight, "blkio-weight", 0, `Block IO (relative weight), between 10 and 1000, or 0 to disable (default 0)`) flags.Int64Var(&options.cpuPeriod, "cpu-period", 0, "Limit CPU CFS (Completely Fair Scheduler) period") flags.Int64Var(&options.cpuQuota, "cpu-quota", 0, "Limit CPU CFS (Completely Fair Scheduler) quota") flags.Int64Var(&options.cpuRealtimePeriod, "cpu-rt-period", 0, "Limit the CPU real-time period in microseconds") @@ -68,7 +68,7 @@ func NewUpdateCommand(dockerCli command.Cli) *cobra.Command { flags.Int64VarP(&options.cpuShares, "cpu-shares", "c", 0, "CPU shares (relative weight)") flags.VarP(&options.memory, "memory", "m", "Memory limit") flags.Var(&options.memoryReservation, "memory-reservation", "Memory soft limit") - flags.Var(&options.memorySwap, "memory-swap", "Swap limit equal to memory plus swap: '-1' to enable unlimited swap") + flags.Var(&options.memorySwap, "memory-swap", `Swap limit equal to memory plus swap: -1 to enable unlimited swap`) flags.Var(&options.kernelMemory, "kernel-memory", "Kernel memory limit (deprecated)") // --kernel-memory is deprecated on API v1.42 and up, but our current annotations // do not support only showing on < API-version. This option is no longer supported @@ -77,7 +77,7 @@ func NewUpdateCommand(dockerCli command.Cli) *cobra.Command { flags.MarkHidden("kernel-memory") flags.StringVar(&options.restartPolicy, "restart", "", "Restart policy to apply when a container exits") - flags.Int64Var(&options.pidsLimit, "pids-limit", 0, "Tune container pids limit (set -1 for unlimited)") + flags.Int64Var(&options.pidsLimit, "pids-limit", 0, `Tune container pids limit (set -1 for unlimited)`) flags.SetAnnotation("pids-limit", "version", []string{"1.40"}) flags.Var(&options.cpus, "cpus", "Number of CPUs") diff --git a/cli/command/context/create.go b/cli/command/context/create.go index 7765a9490e..d912dff375 100644 --- a/cli/command/context/create.go +++ b/cli/command/context/create.go @@ -53,7 +53,7 @@ func newCreateCommand(dockerCli command.Cli) *cobra.Command { flags.StringVar(&opts.Description, "description", "", "Description of the context") flags.String( "default-stack-orchestrator", "", - "Default orchestrator for stack operations to use with this context (swarm|kubernetes|all)", + `Default orchestrator for stack operations to use with this context ("swarm", "kubernetes", "all")`, ) flags.SetAnnotation("default-stack-orchestrator", "deprecated", nil) flags.SetAnnotation("default-stack-orchestrator", "deprecated", nil) diff --git a/cli/command/image/build.go b/cli/command/image/build.go index 29daea7fe7..771f61ec66 100644 --- a/cli/command/image/build.go +++ b/cli/command/image/build.go @@ -115,13 +115,13 @@ func NewBuildCommand(dockerCli command.Cli) *cobra.Command { flags := cmd.Flags() - flags.VarP(&options.tags, "tag", "t", "Name and optionally a tag in the 'name:tag' format") + flags.VarP(&options.tags, "tag", "t", `Name and optionally a tag in the "name:tag" format`) flags.Var(&options.buildArgs, "build-arg", "Set build-time variables") flags.Var(options.ulimits, "ulimit", "Ulimit options") - flags.StringVarP(&options.dockerfileName, "file", "f", "", "Name of the Dockerfile (Default is 'PATH/Dockerfile')") + flags.StringVarP(&options.dockerfileName, "file", "f", "", `Name of the Dockerfile (Default is "PATH/Dockerfile")`) flags.VarP(&options.memory, "memory", "m", "Memory limit") - flags.Var(&options.memorySwap, "memory-swap", "Swap limit equal to memory plus swap: '-1' to enable unlimited swap") - flags.Var(&options.shmSize, "shm-size", "Size of /dev/shm") + flags.Var(&options.memorySwap, "memory-swap", `Swap limit equal to memory plus swap: -1 to enable unlimited swap`) + flags.Var(&options.shmSize, "shm-size", `Size of "/dev/shm"`) flags.Int64VarP(&options.cpuShares, "cpu-shares", "c", 0, "CPU shares (relative weight)") flags.Int64Var(&options.cpuPeriod, "cpu-period", 0, "Limit the CPU CFS (Completely Fair Scheduler) period") flags.Int64Var(&options.cpuQuota, "cpu-quota", 0, "Limit the CPU CFS (Completely Fair Scheduler) quota") @@ -140,7 +140,7 @@ func NewBuildCommand(dockerCli command.Cli) *cobra.Command { flags.StringSliceVar(&options.securityOpt, "security-opt", []string{}, "Security options") flags.StringVar(&options.networkMode, "network", "default", "Set the networking mode for the RUN instructions during build") flags.SetAnnotation("network", "version", []string{"1.25"}) - flags.Var(&options.extraHosts, "add-host", "Add a custom host-to-IP mapping (host:ip)") + flags.Var(&options.extraHosts, "add-host", `Add a custom host-to-IP mapping ("host:ip")`) flags.StringVar(&options.target, "target", "", "Set the target build stage to build.") flags.StringVar(&options.imageIDFile, "iidfile", "", "Write the image ID to the file") diff --git a/cli/command/image/prune.go b/cli/command/image/prune.go index 9eb73d5b9c..c94c1be596 100644 --- a/cli/command/image/prune.go +++ b/cli/command/image/prune.go @@ -45,7 +45,7 @@ func NewPruneCommand(dockerCli command.Cli) *cobra.Command { flags := cmd.Flags() flags.BoolVarP(&options.force, "force", "f", false, "Do not prompt for confirmation") flags.BoolVarP(&options.all, "all", "a", false, "Remove all unused images, not just dangling ones") - flags.Var(&options.filter, "filter", "Provide filter values (e.g. 'until=')") + flags.Var(&options.filter, "filter", `Provide filter values (e.g. "until=")`) return cmd } diff --git a/cli/command/network/connect.go b/cli/command/network/connect.go index 0c7552542d..75e3c0b4c8 100644 --- a/cli/command/network/connect.go +++ b/cli/command/network/connect.go @@ -48,8 +48,8 @@ func newConnectCommand(dockerCli command.Cli) *cobra.Command { } flags := cmd.Flags() - flags.StringVar(&options.ipaddress, "ip", "", "IPv4 address (e.g., 172.30.100.104)") - flags.StringVar(&options.ipv6address, "ip6", "", "IPv6 address (e.g., 2001:db8::33)") + flags.StringVar(&options.ipaddress, "ip", "", `IPv4 address (e.g., "172.30.100.104")`) + flags.StringVar(&options.ipv6address, "ip6", "", `IPv6 address (e.g., "2001:db8::33")`) flags.Var(&options.links, "link", "Add link to another container") flags.StringSliceVar(&options.aliases, "alias", []string{}, "Add network-scoped alias for the container") flags.StringSliceVar(&options.linklocalips, "link-local-ip", []string{}, "Add a link-local address for the container") diff --git a/cli/command/network/list.go b/cli/command/network/list.go index bd75d66056..903b561ac9 100644 --- a/cli/command/network/list.go +++ b/cli/command/network/list.go @@ -40,7 +40,7 @@ func newListCommand(dockerCli command.Cli) *cobra.Command { flags.BoolVarP(&options.quiet, "quiet", "q", false, "Only display network IDs") flags.BoolVar(&options.noTrunc, "no-trunc", false, "Do not truncate the output") flags.StringVar(&options.format, "format", "", flagsHelper.FormatHelp) - flags.VarP(&options.filter, "filter", "f", "Provide filter values (e.g. 'driver=bridge')") + flags.VarP(&options.filter, "filter", "f", `Provide filter values (e.g. "driver=bridge")`) return cmd } diff --git a/cli/command/network/prune.go b/cli/command/network/prune.go index 4f0617b0f6..928edb3344 100644 --- a/cli/command/network/prune.go +++ b/cli/command/network/prune.go @@ -38,7 +38,7 @@ func NewPruneCommand(dockerCli command.Cli) *cobra.Command { flags := cmd.Flags() flags.BoolVarP(&options.force, "force", "f", false, "Do not prompt for confirmation") - flags.Var(&options.filter, "filter", "Provide filter values (e.g. 'until=')") + flags.Var(&options.filter, "filter", `Provide filter values (e.g. "until=")`) return cmd } diff --git a/cli/command/node/update.go b/cli/command/node/update.go index 38b3a462d5..2353172080 100644 --- a/cli/command/node/update.go +++ b/cli/command/node/update.go @@ -28,9 +28,9 @@ func newUpdateCommand(dockerCli command.Cli) *cobra.Command { } flags := cmd.Flags() - flags.StringVar(&options.role, flagRole, "", `Role of the node ("worker"|"manager")`) - flags.StringVar(&options.availability, flagAvailability, "", `Availability of the node ("active"|"pause"|"drain")`) - flags.Var(&options.annotations.labels, flagLabelAdd, "Add or update a node label (key=value)") + flags.StringVar(&options.role, flagRole, "", `Role of the node ("worker", "manager")`) + flags.StringVar(&options.availability, flagAvailability, "", `Availability of the node ("active", "pause", "drain")`) + flags.Var(&options.annotations.labels, flagLabelAdd, `Add or update a node label ("key=value")`) labelKeys := opts.NewListOpts(nil) flags.Var(&labelKeys, flagLabelRemove, "Remove a node label if exists") return cmd diff --git a/cli/command/plugin/list.go b/cli/command/plugin/list.go index 2b26b119d4..5f4344f9f6 100644 --- a/cli/command/plugin/list.go +++ b/cli/command/plugin/list.go @@ -40,7 +40,7 @@ func newListCommand(dockerCli command.Cli) *cobra.Command { flags.BoolVarP(&options.quiet, "quiet", "q", false, "Only display plugin IDs") flags.BoolVar(&options.noTrunc, "no-trunc", false, "Don't truncate output") flags.StringVar(&options.format, "format", "", flagsHelper.FormatHelp) - flags.VarP(&options.filter, "filter", "f", "Provide filter values (e.g. 'enabled=true')") + flags.VarP(&options.filter, "filter", "f", `Provide filter values (e.g. "enabled=true")`) return cmd } diff --git a/cli/command/service/create.go b/cli/command/service/create.go index d0543e60e3..8d4bc76cdd 100644 --- a/cli/command/service/create.go +++ b/cli/command/service/create.go @@ -33,7 +33,7 @@ func newCreateCommand(dockerCli command.Cli) *cobra.Command { ValidArgsFunction: completion.NoComplete, } flags := cmd.Flags() - flags.StringVar(&opts.mode, flagMode, "replicated", "Service mode (replicated, global, replicated-job, or global-job)") + flags.StringVar(&opts.mode, flagMode, "replicated", `Service mode ("replicated", "global", "replicated-job", "global-job")`) flags.StringVar(&opts.name, flagName, "", "Service name") addServiceFlags(flags, opts, buildServiceDefaultFlagMapping()) diff --git a/cli/command/service/logs.go b/cli/command/service/logs.go index ce18b124af..215bad74d9 100644 --- a/cli/command/service/logs.go +++ b/cli/command/service/logs.go @@ -62,7 +62,7 @@ func newLogsCommand(dockerCli command.Cli) *cobra.Command { flags.BoolVar(&opts.noTaskIDs, "no-task-ids", false, "Do not include task IDs in output") // options identical to container logs flags.BoolVarP(&opts.follow, "follow", "f", false, "Follow log output") - flags.StringVar(&opts.since, "since", "", "Show logs since timestamp (e.g. 2013-01-02T13:23:37Z) or relative (e.g. 42m for 42 minutes)") + flags.StringVar(&opts.since, "since", "", `Show logs since timestamp (e.g. "2013-01-02T13:23:37Z") or relative (e.g. "42m" for 42 minutes)`) flags.BoolVarP(&opts.timestamps, "timestamps", "t", false, "Show timestamps") flags.BoolVar(&opts.details, "details", false, "Show extra details provided to logs") flags.SetAnnotation("details", "version", []string{"1.30"}) diff --git a/cli/command/service/opts.go b/cli/command/service/opts.go index fa44b84962..97201fd432 100644 --- a/cli/command/service/opts.go +++ b/cli/command/service/opts.go @@ -857,7 +857,7 @@ func addServiceFlags(flags *pflag.FlagSet, opts *serviceOptions, defaultFlagValu flags.Uint64Var(&opts.maxReplicas, flagMaxReplicas, defaultFlagValues.getUint64(flagMaxReplicas), "Maximum number of tasks per node (default 0 = unlimited)") flags.SetAnnotation(flagMaxReplicas, "version", []string{"1.40"}) - flags.StringVar(&opts.restartPolicy.condition, flagRestartCondition, "", flagDesc(flagRestartCondition, `Restart when condition is met ("none"|"on-failure"|"any")`)) + flags.StringVar(&opts.restartPolicy.condition, flagRestartCondition, "", flagDesc(flagRestartCondition, `Restart when condition is met ("none", "on-failure", "any")`)) flags.Var(&opts.restartPolicy.delay, flagRestartDelay, flagDesc(flagRestartDelay, "Delay between restart attempts (ns|us|ms|s|m|h)")) flags.Var(&opts.restartPolicy.maxAttempts, flagRestartMaxAttempts, flagDesc(flagRestartMaxAttempts, "Maximum number of restarts before giving up")) @@ -867,10 +867,10 @@ func addServiceFlags(flags *pflag.FlagSet, opts *serviceOptions, defaultFlagValu flags.DurationVar(&opts.update.delay, flagUpdateDelay, 0, flagDesc(flagUpdateDelay, "Delay between updates (ns|us|ms|s|m|h)")) flags.DurationVar(&opts.update.monitor, flagUpdateMonitor, 0, flagDesc(flagUpdateMonitor, "Duration after each task update to monitor for failure (ns|us|ms|s|m|h)")) flags.SetAnnotation(flagUpdateMonitor, "version", []string{"1.25"}) - flags.StringVar(&opts.update.onFailure, flagUpdateFailureAction, "", flagDesc(flagUpdateFailureAction, `Action on update failure ("pause"|"continue"|"rollback")`)) + flags.StringVar(&opts.update.onFailure, flagUpdateFailureAction, "", flagDesc(flagUpdateFailureAction, `Action on update failure ("pause", "continue", "rollback")`)) flags.Var(&opts.update.maxFailureRatio, flagUpdateMaxFailureRatio, flagDesc(flagUpdateMaxFailureRatio, "Failure rate to tolerate during an update")) flags.SetAnnotation(flagUpdateMaxFailureRatio, "version", []string{"1.25"}) - flags.StringVar(&opts.update.order, flagUpdateOrder, "", flagDesc(flagUpdateOrder, `Update order ("start-first"|"stop-first")`)) + flags.StringVar(&opts.update.order, flagUpdateOrder, "", flagDesc(flagUpdateOrder, `Update order ("start-first", "stop-first")`)) flags.SetAnnotation(flagUpdateOrder, "version", []string{"1.29"}) flags.Uint64Var(&opts.rollback.parallelism, flagRollbackParallelism, defaultFlagValues.getUint64(flagRollbackParallelism), @@ -880,11 +880,11 @@ func addServiceFlags(flags *pflag.FlagSet, opts *serviceOptions, defaultFlagValu flags.SetAnnotation(flagRollbackDelay, "version", []string{"1.28"}) flags.DurationVar(&opts.rollback.monitor, flagRollbackMonitor, 0, flagDesc(flagRollbackMonitor, "Duration after each task rollback to monitor for failure (ns|us|ms|s|m|h)")) flags.SetAnnotation(flagRollbackMonitor, "version", []string{"1.28"}) - flags.StringVar(&opts.rollback.onFailure, flagRollbackFailureAction, "", flagDesc(flagRollbackFailureAction, `Action on rollback failure ("pause"|"continue")`)) + flags.StringVar(&opts.rollback.onFailure, flagRollbackFailureAction, "", flagDesc(flagRollbackFailureAction, `Action on rollback failure ("pause", "continue")`)) flags.SetAnnotation(flagRollbackFailureAction, "version", []string{"1.28"}) flags.Var(&opts.rollback.maxFailureRatio, flagRollbackMaxFailureRatio, flagDesc(flagRollbackMaxFailureRatio, "Failure rate to tolerate during a rollback")) flags.SetAnnotation(flagRollbackMaxFailureRatio, "version", []string{"1.28"}) - flags.StringVar(&opts.rollback.order, flagRollbackOrder, "", flagDesc(flagRollbackOrder, `Rollback order ("start-first"|"stop-first")`)) + flags.StringVar(&opts.rollback.order, flagRollbackOrder, "", flagDesc(flagRollbackOrder, `Rollback order ("start-first", "stop-first")`)) flags.SetAnnotation(flagRollbackOrder, "version", []string{"1.29"}) flags.StringVar(&opts.endpoint.mode, flagEndpointMode, defaultFlagValues.getString(flagEndpointMode), "Endpoint mode (vip or dnsrr)") diff --git a/cli/command/service/update.go b/cli/command/service/update.go index 482b91bc2f..2ef9014cab 100644 --- a/cli/command/service/update.go +++ b/cli/command/service/update.go @@ -62,7 +62,7 @@ func newUpdateCommand(dockerCli command.Cli) *cobra.Command { flags.SetAnnotation(flagDNSOptionRemove, "version", []string{"1.25"}) flags.Var(newListOptsVar(), flagDNSSearchRemove, "Remove a DNS search domain") flags.SetAnnotation(flagDNSSearchRemove, "version", []string{"1.25"}) - flags.Var(newListOptsVar(), flagHostRemove, "Remove a custom host-to-IP mapping (host:ip)") + flags.Var(newListOptsVar(), flagHostRemove, `Remove a custom host-to-IP mapping ("host:ip")`) flags.SetAnnotation(flagHostRemove, "version", []string{"1.25"}) flags.Var(&options.labels, flagLabelAdd, "Add or update a service label") flags.Var(&options.containerLabels, flagContainerLabelAdd, "Add or update a container label") @@ -96,7 +96,7 @@ func newUpdateCommand(dockerCli command.Cli) *cobra.Command { flags.SetAnnotation(flagDNSOptionAdd, "version", []string{"1.25"}) flags.Var(&options.dnsSearch, flagDNSSearchAdd, "Add or update a custom DNS search domain") flags.SetAnnotation(flagDNSSearchAdd, "version", []string{"1.25"}) - flags.Var(&options.hosts, flagHostAdd, "Add a custom host-to-IP mapping (host:ip)") + flags.Var(&options.hosts, flagHostAdd, `Add a custom host-to-IP mapping ("host:ip")`) flags.SetAnnotation(flagHostAdd, "version", []string{"1.25"}) flags.BoolVar(&options.init, flagInit, false, "Use an init inside each service container to forward signals and reap processes") flags.SetAnnotation(flagInit, "version", []string{"1.37"}) diff --git a/cli/command/stack/deploy.go b/cli/command/stack/deploy.go index e02524ec1e..1c9643e3ef 100644 --- a/cli/command/stack/deploy.go +++ b/cli/command/stack/deploy.go @@ -42,7 +42,7 @@ func newDeployCommand(dockerCli command.Cli) *cobra.Command { flags.BoolVar(&opts.Prune, "prune", false, "Prune services that are no longer referenced") flags.SetAnnotation("prune", "version", []string{"1.27"}) flags.StringVar(&opts.ResolveImage, "resolve-image", swarm.ResolveImageAlways, - `Query the registry to resolve image digest and supported platforms ("`+swarm.ResolveImageAlways+`"|"`+swarm.ResolveImageChanged+`"|"`+swarm.ResolveImageNever+`")`) + `Query the registry to resolve image digest and supported platforms ("`+swarm.ResolveImageAlways+`", "`+swarm.ResolveImageChanged+`", "`+swarm.ResolveImageNever+`")`) flags.SetAnnotation("resolve-image", "version", []string{"1.30"}) return cmd } diff --git a/cli/command/swarm/init.go b/cli/command/swarm/init.go index 8792e3ff50..443e9055d7 100644 --- a/cli/command/swarm/init.go +++ b/cli/command/swarm/init.go @@ -48,15 +48,15 @@ func newInitCommand(dockerCli command.Cli) *cobra.Command { } flags := cmd.Flags() - flags.Var(&opts.listenAddr, flagListenAddr, "Listen address (format: [:port])") - flags.StringVar(&opts.advertiseAddr, flagAdvertiseAddr, "", "Advertised address (format: [:port])") - flags.StringVar(&opts.dataPathAddr, flagDataPathAddr, "", "Address or interface to use for data path traffic (format: )") + flags.Var(&opts.listenAddr, flagListenAddr, `Listen address (format: "[:port]")`) + flags.StringVar(&opts.advertiseAddr, flagAdvertiseAddr, "", `Advertised address (format: "[:port]")`) + flags.StringVar(&opts.dataPathAddr, flagDataPathAddr, "", `Address or interface to use for data path traffic (format: "")`) flags.SetAnnotation(flagDataPathAddr, "version", []string{"1.31"}) flags.Uint32Var(&opts.dataPathPort, flagDataPathPort, 0, "Port number to use for data path traffic (1024 - 49151). If no value is set or is set to 0, the default port (4789) is used.") flags.SetAnnotation(flagDataPathPort, "version", []string{"1.40"}) flags.BoolVar(&opts.forceNewCluster, "force-new-cluster", false, "Force create a new cluster from current state") flags.BoolVar(&opts.autolock, flagAutolock, false, "Enable manager autolocking (requiring an unlock key to start a stopped manager)") - flags.StringVar(&opts.availability, flagAvailability, "active", `Availability of the node ("active"|"pause"|"drain")`) + flags.StringVar(&opts.availability, flagAvailability, "active", `Availability of the node ("active", "pause", "drain")`) flags.Var(newIPNetSliceValue([]net.IPNet{}, &opts.defaultAddrPools), flagDefaultAddrPool, "default address pool in CIDR format") flags.SetAnnotation(flagDefaultAddrPool, "version", []string{"1.39"}) flags.Uint32Var(&opts.DefaultAddrPoolMaskLength, flagDefaultAddrPoolMaskLength, 24, "default address pool subnet mask length") diff --git a/cli/command/swarm/join.go b/cli/command/swarm/join.go index 59effb21d1..d36efbdb76 100644 --- a/cli/command/swarm/join.go +++ b/cli/command/swarm/join.go @@ -43,12 +43,12 @@ func newJoinCommand(dockerCli command.Cli) *cobra.Command { } flags := cmd.Flags() - flags.Var(&opts.listenAddr, flagListenAddr, "Listen address (format: [:port])") - flags.StringVar(&opts.advertiseAddr, flagAdvertiseAddr, "", "Advertised address (format: [:port])") - flags.StringVar(&opts.dataPathAddr, flagDataPathAddr, "", "Address or interface to use for data path traffic (format: )") + flags.Var(&opts.listenAddr, flagListenAddr, `Listen address (format: "[:port]")`) + flags.StringVar(&opts.advertiseAddr, flagAdvertiseAddr, "", `Advertised address (format: "[:port]")`) + flags.StringVar(&opts.dataPathAddr, flagDataPathAddr, "", `Address or interface to use for data path traffic (format: "")`) flags.SetAnnotation(flagDataPathAddr, "version", []string{"1.31"}) flags.StringVar(&opts.token, flagToken, "", "Token for entry into the swarm") - flags.StringVar(&opts.availability, flagAvailability, "active", `Availability of the node ("active"|"pause"|"drain")`) + flags.StringVar(&opts.availability, flagAvailability, "active", `Availability of the node ("active", "pause", "drain")`) return cmd } diff --git a/cli/command/system/prune.go b/cli/command/system/prune.go index 4e1042ed6e..51773cce3a 100644 --- a/cli/command/system/prune.go +++ b/cli/command/system/prune.go @@ -49,7 +49,7 @@ func newPruneCommand(dockerCli command.Cli) *cobra.Command { flags.BoolVarP(&options.force, "force", "f", false, "Do not prompt for confirmation") flags.BoolVarP(&options.all, "all", "a", false, "Remove all unused images not just dangling ones") flags.BoolVar(&options.pruneVolumes, "volumes", false, "Prune volumes") - flags.Var(&options.filter, "filter", "Provide filter values (e.g. 'label==')") + flags.Var(&options.filter, "filter", `Provide filter values (e.g. "label==")`) // "filter" flag is available in 1.28 (docker 17.04) and up flags.SetAnnotation("filter", "version", []string{"1.28"}) diff --git a/cli/command/volume/create.go b/cli/command/volume/create.go index a3219da92a..1884949c69 100644 --- a/cli/command/volume/create.go +++ b/cli/command/volume/create.go @@ -72,16 +72,16 @@ func newCreateCommand(dockerCli command.Cli) *cobra.Command { flags.StringVar(&options.group, "group", "", "Cluster Volume group (cluster volumes)") flags.SetAnnotation("group", "version", []string{"1.42"}) flags.SetAnnotation("group", "swarm", []string{"manager"}) - flags.StringVar(&options.scope, "scope", "single", `Cluster Volume access scope ("single"|"multi")`) + flags.StringVar(&options.scope, "scope", "single", `Cluster Volume access scope ("single", "multi")`) flags.SetAnnotation("scope", "version", []string{"1.42"}) flags.SetAnnotation("scope", "swarm", []string{"manager"}) - flags.StringVar(&options.sharing, "sharing", "none", `Cluster Volume access sharing ("none"|"readonly"|"onewriter"|"all")`) + flags.StringVar(&options.sharing, "sharing", "none", `Cluster Volume access sharing ("none", "readonly", "onewriter", "all")`) flags.SetAnnotation("sharing", "version", []string{"1.42"}) flags.SetAnnotation("sharing", "swarm", []string{"manager"}) - flags.StringVar(&options.availability, "availability", "active", `Cluster Volume availability ("active"|"pause"|"drain")`) + flags.StringVar(&options.availability, "availability", "active", `Cluster Volume availability ("active", "pause", "drain")`) flags.SetAnnotation("availability", "version", []string{"1.42"}) flags.SetAnnotation("availability", "swarm", []string{"manager"}) - flags.StringVar(&options.accessType, "type", "block", `Cluster Volume access type ("mount"|"block")`) + flags.StringVar(&options.accessType, "type", "block", `Cluster Volume access type ("mount", "block")`) flags.SetAnnotation("type", "version", []string{"1.42"}) flags.SetAnnotation("type", "swarm", []string{"manager"}) flags.Var(&options.secrets, "secret", "Cluster Volume secrets") diff --git a/cli/command/volume/list.go b/cli/command/volume/list.go index 6b376d6c5d..88da102c47 100644 --- a/cli/command/volume/list.go +++ b/cli/command/volume/list.go @@ -42,7 +42,7 @@ func newListCommand(dockerCli command.Cli) *cobra.Command { flags := cmd.Flags() flags.BoolVarP(&options.quiet, "quiet", "q", false, "Only display volume names") flags.StringVar(&options.format, "format", "", flagsHelper.FormatHelp) - flags.VarP(&options.filter, "filter", "f", "Provide filter values (e.g. 'dangling=true')") + flags.VarP(&options.filter, "filter", "f", `Provide filter values (e.g. "dangling=true")`) flags.BoolVar(&options.cluster, "cluster", false, "Display only cluster volumes, and use cluster volume list formatting") flags.SetAnnotation("cluster", "version", []string{"1.42"}) flags.SetAnnotation("cluster", "swarm", []string{"manager"}) diff --git a/cli/command/volume/prune.go b/cli/command/volume/prune.go index 8f95f499f0..16fd550898 100644 --- a/cli/command/volume/prune.go +++ b/cli/command/volume/prune.go @@ -42,7 +42,7 @@ func NewPruneCommand(dockerCli command.Cli) *cobra.Command { flags := cmd.Flags() flags.BoolVarP(&options.force, "force", "f", false, "Do not prompt for confirmation") - flags.Var(&options.filter, "filter", "Provide filter values (e.g. 'label=