Browse code

Change to plural forms for help output of `docker service update`

This fix is based on the comment in
https://github.com/docker/docker/pull/27567#discussion_r86910604

Basically, in the help output of `docker service update`, the `--xxx-add`
flags typically have plural forms while `--xxx-rm` flags have singular
forms.

This fix updates the help output for consistency.

This fix also updates the related docs in `service_update.md`.
The help output in `service_update.md` has been quite out-of-sync
with the actual output so this fix replaces the output with the
most up-to-date output.

This fix is related to #27567.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>

Yong Tang authored on 2016/11/08 11:40:47
Showing 2 changed files
... ...
@@ -42,19 +42,19 @@ func newUpdateCommand(dockerCli *command.DockerCli) *cobra.Command {
42 42
 	addServiceFlags(cmd, opts)
43 43
 
44 44
 	flags.Var(newListOptsVar(), flagEnvRemove, "Remove an environment variable")
45
-	flags.Var(newListOptsVar(), flagGroupRemove, "Remove previously added supplementary user groups from the container")
45
+	flags.Var(newListOptsVar(), flagGroupRemove, "Remove a previously added supplementary user group from the container")
46 46
 	flags.Var(newListOptsVar(), flagLabelRemove, "Remove a label by its key")
47 47
 	flags.Var(newListOptsVar(), flagContainerLabelRemove, "Remove a container label by its key")
48 48
 	flags.Var(newListOptsVar(), flagMountRemove, "Remove a mount by its target path")
49 49
 	flags.Var(newListOptsVar(), flagPublishRemove, "Remove a published port by its target port")
50 50
 	flags.Var(newListOptsVar(), flagConstraintRemove, "Remove a constraint")
51
-	flags.Var(&opts.labels, flagLabelAdd, "Add or update service labels")
52
-	flags.Var(&opts.containerLabels, flagContainerLabelAdd, "Add or update container labels")
53
-	flags.Var(&opts.env, flagEnvAdd, "Add or update environment variables")
51
+	flags.Var(&opts.labels, flagLabelAdd, "Add or update a service label")
52
+	flags.Var(&opts.containerLabels, flagContainerLabelAdd, "Add or update a container label")
53
+	flags.Var(&opts.env, flagEnvAdd, "Add or update an environment variable")
54 54
 	flags.Var(&opts.mounts, flagMountAdd, "Add or update a mount on a service")
55
-	flags.StringSliceVar(&opts.constraints, flagConstraintAdd, []string{}, "Add or update placement constraints")
55
+	flags.StringSliceVar(&opts.constraints, flagConstraintAdd, []string{}, "Add or update a placement constraint")
56 56
 	flags.Var(&opts.endpoint.ports, flagPublishAdd, "Add or update a published port")
57
-	flags.StringSliceVar(&opts.groups, flagGroupAdd, []string{}, "Add additional supplementary user groups to the container")
57
+	flags.StringSliceVar(&opts.groups, flagGroupAdd, []string{}, "Add an additional supplementary user group to the container")
58 58
 	return cmd
59 59
 }
60 60
 
... ...
@@ -21,52 +21,52 @@ Usage:  docker service update [OPTIONS] SERVICE
21 21
 Update a service
22 22
 
23 23
 Options:
24
-      --args string                      Service command args
25
-      --constraint-add value             Add or update placement constraints (default [])
26
-      --constraint-rm value              Remove a constraint (default [])
27
-      --container-label-add value        Add or update container labels (default [])
28
-      --container-label-rm value         Remove a container label by its key (default [])
29
-      --endpoint-mode string             Endpoint mode (vip or dnsrr)
30
-      --env-add value                    Add or update environment variables (default [])
31
-      --env-rm value                     Remove an environment variable (default [])
32
-      --force                            Force update even if no changes require it
33
-      --group-add value                  Add additional supplementary user groups to the container (default [])
34
-      --group-rm value                   Remove previously added supplementary user groups from the container (default [])
35
-      --health-cmd string                Command to run to check health
36
-      --health-interval duration         Time between running the check
37
-      --health-retries int               Consecutive failures needed to report unhealthy
38
-      --health-timeout duration          Maximum time to allow one check to run
39
-      --help                             Print usage
40
-      --image string                     Service image tag
41
-      --label-add value                  Add or update service labels (default [])
42
-      --label-rm value                   Remove a label by its key (default [])
43
-      --limit-cpu value                  Limit CPUs (default 0.000)
44
-      --limit-memory value               Limit Memory (default 0 B)
45
-      --log-driver string                Logging driver for service
46
-      --log-opt value                    Logging driver options (default [])
47
-      --mount-add value                  Add or update a mount on a service
48
-      --mount-rm value                   Remove a mount by its target path (default [])
49
-      --no-healthcheck                   Disable any container-specified HEALTHCHECK
50
-      --publish-add value                Add or update a published port (default [])
51
-      --publish-rm value                 Remove a published port by its target port (default [])
52
-      --replicas value                   Number of tasks (default none)
53
-      --reserve-cpu value                Reserve CPUs (default 0.000)
54
-      --reserve-memory value             Reserve Memory (default 0 B)
55
-      --restart-condition string         Restart when condition is met (none, on-failure, or any)
56
-      --restart-delay value              Delay between restart attempts (default none)
57
-      --restart-max-attempts value       Maximum number of restarts before giving up (default none)
58
-      --restart-window value             Window used to evaluate the restart policy (default none)
59
-      --rollback                         Rollback to previous specification
60
-      --stop-grace-period value          Time to wait before force killing a container (default none)
61
-  -t, --tty                              Allocate a pseudo-TTY
62
-      --update-delay duration            Delay between updates
63
-      --update-failure-action string     Action on update failure (pause|continue) (default "pause")
64
-      --update-max-failure-ratio value   Failure rate to tolerate during an update
65
-      --update-monitor duration          Duration after each task update to monitor for failure (default 0s)
66
-      --update-parallelism uint          Maximum number of tasks updated simultaneously (0 to update all at once) (default 1)
67
-  -u, --user string                      Username or UID (format: <name|uid>[:<group|gid>])
68
-      --with-registry-auth               Send registry authentication details to Swarm agents
69
-  -w, --workdir string                   Working directory inside the container
24
+      --args string                        Service command args
25
+      --constraint-add stringSlice         Add or update a placement constraint
26
+      --constraint-rm list                 Remove a constraint (default [])
27
+      --container-label-add list           Add or update a container label (default [])
28
+      --container-label-rm list            Remove a container label by its key (default [])
29
+      --endpoint-mode string               Endpoint mode (vip or dnsrr)
30
+      --env-add list                       Add or update an environment variable (default [])
31
+      --env-rm list                        Remove an environment variable (default [])
32
+      --force                              Force update even if no changes require it
33
+      --group-add stringSlice              Add an additional supplementary user group to the container
34
+      --group-rm list                      Remove a previously added supplementary user group from the container (default [])
35
+      --health-cmd string                  Command to run to check health
36
+      --health-interval duration-ptr       Time between running the check (default none)
37
+      --health-retries int                 Consecutive failures needed to report unhealthy
38
+      --health-timeout duration-ptr        Maximum time to allow one check to run (default none)
39
+      --help                               Print usage
40
+      --image string                       Service image tag
41
+      --label-add list                     Add or update a service label (default [])
42
+      --label-rm list                      Remove a label by its key (default [])
43
+      --limit-cpu NanoCPUs                 Limit CPUs (default 0.000)
44
+      --limit-memory MemoryBytes           Limit Memory (default 0 B)
45
+      --log-driver string                  Logging driver for service
46
+      --log-opt list                       Logging driver options (default [])
47
+      --mount-add mount                    Add or update a mount on a service
48
+      --mount-rm list                      Remove a mount by its target path (default [])
49
+      --no-healthcheck                     Disable any container-specified HEALTHCHECK
50
+      --publish-add list                   Add or update a published port (default [])
51
+      --publish-rm list                    Remove a published port by its target port (default [])
52
+      --replicas uint64-ptr                Number of tasks (default none)
53
+      --reserve-cpu NanoCPUs               Reserve CPUs (default 0.000)
54
+      --reserve-memory MemoryBytes         Reserve Memory (default 0 B)
55
+      --restart-condition string           Restart when condition is met (none, on-failure, or any)
56
+      --restart-delay duration-ptr         Delay between restart attempts (default none)
57
+      --restart-max-attempts uint64-ptr    Maximum number of restarts before giving up (default none)
58
+      --restart-window duration-ptr        Window used to evaluate the restart policy (default none)
59
+      --rollback                           Rollback to previous specification
60
+      --stop-grace-period duration-ptr     Time to wait before force killing a container (default none)
61
+  -t, --tty                                Allocate a pseudo-TTY
62
+      --update-delay duration              Delay between updates
63
+      --update-failure-action string       Action on update failure (pause|continue) (default "pause")
64
+      --update-max-failure-ratio float32   Failure rate to tolerate during an update
65
+      --update-monitor duration            Duration after each task update to monitor for failure
66
+      --update-parallelism uint            Maximum number of tasks updated simultaneously (0 to update all at once) (default 1)
67
+  -u, --user string                        Username or UID (format: <name|uid>[:<group|gid>])
68
+      --with-registry-auth                 Send registry authentication details to swarm agents
69
+  -w, --workdir string                     Working directory inside the container
70 70
 ```
71 71
 
72 72
 Updates a service as described by the specified parameters. This command has to be run targeting a manager node.