Browse code

Remove `-ptr` from the help output of `service create`

This fix is based on the comment:
https://github.com/docker/docker/pull/28147#discussion_r86996347

Previously the output string of the `DurationOpt` is `duration-ptr`
and `Uint64Opt` is `uint64-ptr`. While it is clear to developers,
for a normal user `-ptr` might not be very informative.

On the other hand, the default value of `DurationOpt` and `Uint64Opt`
has already been quite informative: `none`. That means if no flag
provided, the value will be treated as none.
(like a ptr with nil as the default)

For that reason this fix removes the `-ptr`.

Also, the output in the docs of `service create` has been quite
out-of-sync with the true output. So this fix updates the docs
to have the most up-to-date help output of `service create --help`.

This fix is related to #28147.

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

Yong Tang authored on 2016/11/09 00:06:07
Showing 6 changed files
... ...
@@ -37,10 +37,10 @@ func newCreateCommand(dockerCli *command.DockerCli) *cobra.Command {
37 37
 	flags.VarP(&opts.env, flagEnv, "e", "Set environment variables")
38 38
 	flags.Var(&opts.envFile, flagEnvFile, "Read in a file of environment variables")
39 39
 	flags.Var(&opts.mounts, flagMount, "Attach a filesystem mount to the service")
40
-	flags.StringSliceVar(&opts.constraints, flagConstraint, []string{}, "Placement constraints")
41
-	flags.StringSliceVar(&opts.networks, flagNetwork, []string{}, "Network attachments")
40
+	flags.Var(&opts.constraints, flagConstraint, "Placement constraints")
41
+	flags.Var(&opts.networks, flagNetwork, "Network attachments")
42 42
 	flags.VarP(&opts.endpoint.ports, flagPublish, "p", "Publish a port as a node port")
43
-	flags.StringSliceVar(&opts.groups, flagGroup, []string{}, "Set one or more supplementary user groups for the container")
43
+	flags.Var(&opts.groups, flagGroup, "Set one or more supplementary user groups for the container")
44 44
 	flags.Var(&opts.dns, flagDNS, "Set custom DNS servers")
45 45
 	flags.Var(&opts.dnsOptions, flagDNSOptions, "Set DNS options")
46 46
 	flags.Var(&opts.dnsSearch, flagDNSSearch, "Set custom DNS search domains")
... ...
@@ -32,7 +32,7 @@ func (m *memBytes) Set(value string) error {
32 32
 }
33 33
 
34 34
 func (m *memBytes) Type() string {
35
-	return "MemoryBytes"
35
+	return "bytes"
36 36
 }
37 37
 
38 38
 func (m *memBytes) Value() int64 {
... ...
@@ -71,9 +71,9 @@ func (d *DurationOpt) Set(s string) error {
71 71
 	return err
72 72
 }
73 73
 
74
-// Type returns the type of this option
74
+// Type returns the type of this option, which will be displayed in `--help` output
75 75
 func (d *DurationOpt) Type() string {
76
-	return "duration-ptr"
76
+	return "duration"
77 77
 }
78 78
 
79 79
 // String returns a string repr of this option
... ...
@@ -101,9 +101,9 @@ func (i *Uint64Opt) Set(s string) error {
101 101
 	return err
102 102
 }
103 103
 
104
-// Type returns the type of this option
104
+// Type returns the type of this option, which will be displayed in `--help` output
105 105
 func (i *Uint64Opt) Type() string {
106
-	return "uint64-ptr"
106
+	return "uint"
107 107
 }
108 108
 
109 109
 // String returns a string repr of this option
... ...
@@ -119,12 +119,32 @@ func (i *Uint64Opt) Value() *uint64 {
119 119
 	return i.value
120 120
 }
121 121
 
122
+type floatValue float32
123
+
124
+func (f *floatValue) Set(s string) error {
125
+	v, err := strconv.ParseFloat(s, 32)
126
+	*f = floatValue(v)
127
+	return err
128
+}
129
+
130
+func (f *floatValue) Type() string {
131
+	return "float"
132
+}
133
+
134
+func (f *floatValue) String() string {
135
+	return strconv.FormatFloat(float64(*f), 'g', -1, 32)
136
+}
137
+
138
+func (f *floatValue) Value() float32 {
139
+	return float32(*f)
140
+}
141
+
122 142
 type updateOptions struct {
123 143
 	parallelism     uint64
124 144
 	delay           time.Duration
125 145
 	monitor         time.Duration
126 146
 	onFailure       string
127
-	maxFailureRatio float32
147
+	maxFailureRatio floatValue
128 148
 }
129 149
 
130 150
 type resourceOptions struct {
... ...
@@ -293,7 +313,7 @@ type serviceOptions struct {
293 293
 	envFile         opts.ListOpts
294 294
 	workdir         string
295 295
 	user            string
296
-	groups          []string
296
+	groups          opts.ListOpts
297 297
 	tty             bool
298 298
 	mounts          opts.MountOpt
299 299
 	dns             opts.ListOpts
... ...
@@ -307,9 +327,9 @@ type serviceOptions struct {
307 307
 	mode     string
308 308
 
309 309
 	restartPolicy restartPolicyOptions
310
-	constraints   []string
310
+	constraints   opts.ListOpts
311 311
 	update        updateOptions
312
-	networks      []string
312
+	networks      opts.ListOpts
313 313
 	endpoint      endpointOptions
314 314
 
315 315
 	registryAuth bool
... ...
@@ -322,16 +342,19 @@ type serviceOptions struct {
322 322
 func newServiceOptions() *serviceOptions {
323 323
 	return &serviceOptions{
324 324
 		labels:          opts.NewListOpts(runconfigopts.ValidateEnv),
325
+		constraints:     opts.NewListOpts(nil),
325 326
 		containerLabels: opts.NewListOpts(runconfigopts.ValidateEnv),
326 327
 		env:             opts.NewListOpts(runconfigopts.ValidateEnv),
327 328
 		envFile:         opts.NewListOpts(nil),
328 329
 		endpoint: endpointOptions{
329 330
 			ports: opts.NewListOpts(ValidatePort),
330 331
 		},
332
+		groups:     opts.NewListOpts(nil),
331 333
 		logDriver:  newLogDriverOptions(),
332 334
 		dns:        opts.NewListOpts(opts.ValidateIPAddress),
333 335
 		dnsOptions: opts.NewListOpts(nil),
334 336
 		dnsSearch:  opts.NewListOpts(opts.ValidateDNSSearch),
337
+		networks:   opts.NewListOpts(nil),
335 338
 	}
336 339
 }
337 340
 
... ...
@@ -371,7 +394,7 @@ func (opts *serviceOptions) ToService() (swarm.ServiceSpec, error) {
371 371
 				Labels:   runconfigopts.ConvertKVStringsToMap(opts.containerLabels.GetAll()),
372 372
 				Dir:      opts.workdir,
373 373
 				User:     opts.user,
374
-				Groups:   opts.groups,
374
+				Groups:   opts.groups.GetAll(),
375 375
 				TTY:      opts.tty,
376 376
 				Mounts:   opts.mounts.Value(),
377 377
 				DNSConfig: &swarm.DNSConfig{
... ...
@@ -381,22 +404,22 @@ func (opts *serviceOptions) ToService() (swarm.ServiceSpec, error) {
381 381
 				},
382 382
 				StopGracePeriod: opts.stopGrace.Value(),
383 383
 			},
384
-			Networks:      convertNetworks(opts.networks),
384
+			Networks:      convertNetworks(opts.networks.GetAll()),
385 385
 			Resources:     opts.resources.ToResourceRequirements(),
386 386
 			RestartPolicy: opts.restartPolicy.ToRestartPolicy(),
387 387
 			Placement: &swarm.Placement{
388
-				Constraints: opts.constraints,
388
+				Constraints: opts.constraints.GetAll(),
389 389
 			},
390 390
 			LogDriver: opts.logDriver.toLogDriver(),
391 391
 		},
392
-		Networks: convertNetworks(opts.networks),
392
+		Networks: convertNetworks(opts.networks.GetAll()),
393 393
 		Mode:     swarm.ServiceMode{},
394 394
 		UpdateConfig: &swarm.UpdateConfig{
395 395
 			Parallelism:     opts.update.parallelism,
396 396
 			Delay:           opts.update.delay,
397 397
 			Monitor:         opts.update.monitor,
398 398
 			FailureAction:   opts.update.onFailure,
399
-			MaxFailureRatio: opts.update.maxFailureRatio,
399
+			MaxFailureRatio: opts.update.maxFailureRatio.Value(),
400 400
 		},
401 401
 		EndpointSpec: opts.endpoint.ToEndpointSpec(),
402 402
 	}
... ...
@@ -449,7 +472,7 @@ func addServiceFlags(cmd *cobra.Command, opts *serviceOptions) {
449 449
 	flags.DurationVar(&opts.update.delay, flagUpdateDelay, time.Duration(0), "Delay between updates (ns|us|ms|s|m|h) (default 0s)")
450 450
 	flags.DurationVar(&opts.update.monitor, flagUpdateMonitor, time.Duration(0), "Duration after each task update to monitor for failure (ns|us|ms|s|m|h) (default 0s)")
451 451
 	flags.StringVar(&opts.update.onFailure, flagUpdateFailureAction, "pause", "Action on update failure (pause|continue)")
452
-	flags.Float32Var(&opts.update.maxFailureRatio, flagUpdateMaxFailureRatio, 0, "Failure rate to tolerate during an update")
452
+	flags.Var(&opts.update.maxFailureRatio, flagUpdateMaxFailureRatio, "Failure rate to tolerate during an update")
453 453
 
454 454
 	flags.StringVar(&opts.endpoint.mode, flagEndpointMode, "", "Endpoint mode (vip or dnsrr)")
455 455
 
... ...
@@ -55,9 +55,9 @@ func newUpdateCommand(dockerCli *command.DockerCli) *cobra.Command {
55 55
 	flags.Var(&opts.containerLabels, flagContainerLabelAdd, "Add or update a container label")
56 56
 	flags.Var(&opts.env, flagEnvAdd, "Add or update an environment variable")
57 57
 	flags.Var(&opts.mounts, flagMountAdd, "Add or update a mount on a service")
58
-	flags.StringSliceVar(&opts.constraints, flagConstraintAdd, []string{}, "Add or update a placement constraint")
58
+	flags.Var(&opts.constraints, flagConstraintAdd, "Add or update a placement constraint")
59 59
 	flags.Var(&opts.endpoint.ports, flagPublishAdd, "Add or update a published port")
60
-	flags.StringSliceVar(&opts.groups, flagGroupAdd, []string{}, "Add an additional supplementary user group to the container")
60
+	flags.Var(&opts.groups, flagGroupAdd, "Add an additional supplementary user group to the container")
61 61
 	flags.Var(&opts.dns, flagDNSAdd, "Add or update custom DNS servers")
62 62
 	flags.Var(&opts.dnsOptions, flagDNSOptionsAdd, "Add or update DNS options")
63 63
 	flags.Var(&opts.dnsSearch, flagDNSSearchAdd, "Add or update custom DNS search domains")
... ...
@@ -139,9 +139,9 @@ func updateService(flags *pflag.FlagSet, spec *swarm.ServiceSpec) error {
139 139
 		}
140 140
 	}
141 141
 
142
-	updateFloat32 := func(flag string, field *float32) {
142
+	updateFloatValue := func(flag string, field *float32) {
143 143
 		if flags.Changed(flag) {
144
-			*field, _ = flags.GetFloat32(flag)
144
+			*field = flags.Lookup(flag).Value.(*floatValue).Value()
145 145
 		}
146 146
 	}
147 147
 
... ...
@@ -238,7 +238,7 @@ func updateService(flags *pflag.FlagSet, spec *swarm.ServiceSpec) error {
238 238
 		updateDuration(flagUpdateDelay, &spec.UpdateConfig.Delay)
239 239
 		updateDuration(flagUpdateMonitor, &spec.UpdateConfig.Monitor)
240 240
 		updateString(flagUpdateFailureAction, &spec.UpdateConfig.FailureAction)
241
-		updateFloat32(flagUpdateMaxFailureRatio, &spec.UpdateConfig.MaxFailureRatio)
241
+		updateFloatValue(flagUpdateMaxFailureRatio, &spec.UpdateConfig.MaxFailureRatio)
242 242
 	}
243 243
 
244 244
 	if flags.Changed(flagEndpointMode) {
... ...
@@ -322,11 +322,22 @@ func anyChanged(flags *pflag.FlagSet, fields ...string) bool {
322 322
 }
323 323
 
324 324
 func updatePlacement(flags *pflag.FlagSet, placement *swarm.Placement) {
325
-	field, _ := flags.GetStringSlice(flagConstraintAdd)
326
-	placement.Constraints = append(placement.Constraints, field...)
327
-
325
+	if flags.Changed(flagConstraintAdd) {
326
+		values := flags.Lookup(flagConstraintAdd).Value.(*opts.ListOpts).GetAll()
327
+		placement.Constraints = append(placement.Constraints, values...)
328
+	}
328 329
 	toRemove := buildToRemoveSet(flags, flagConstraintRemove)
329
-	placement.Constraints = removeItems(placement.Constraints, toRemove, itemKey)
330
+
331
+	newConstraints := []string{}
332
+	for _, constraint := range placement.Constraints {
333
+		if _, exists := toRemove[constraint]; !exists {
334
+			newConstraints = append(newConstraints, constraint)
335
+		}
336
+	}
337
+	// Sort so that result is predictable.
338
+	sort.Strings(newConstraints)
339
+
340
+	placement.Constraints = newConstraints
330 341
 }
331 342
 
332 343
 func updateContainerLabels(flags *pflag.FlagSet, field *map[string]string) {
... ...
@@ -479,10 +490,7 @@ func updateMounts(flags *pflag.FlagSet, mounts *[]mounttypes.Mount) error {
479 479
 
480 480
 func updateGroups(flags *pflag.FlagSet, groups *[]string) error {
481 481
 	if flags.Changed(flagGroupAdd) {
482
-		values, err := flags.GetStringSlice(flagGroupAdd)
483
-		if err != nil {
484
-			return err
485
-		}
482
+		values := flags.Lookup(flagGroupAdd).Value.(*opts.ListOpts).GetAll()
486 483
 		*groups = append(*groups, values...)
487 484
 	}
488 485
 	toRemove := buildToRemoveSet(flags, flagGroupRemove)
... ...
@@ -21,48 +21,48 @@ Usage:  docker service create [OPTIONS] IMAGE [COMMAND] [ARG...]
21 21
 Create a new service
22 22
 
23 23
 Options:
24
-      --constraint value                 Placement constraints (default [])
25
-      --container-label value            Service container labels (default [])
24
+      --constraint list                  Placement constraints (default [])
25
+      --container-label list             Container labels (default [])
26 26
       --dns list                         Set custom DNS servers (default [])
27 27
       --dns-options list                 Set DNS options (default [])
28 28
       --dns-search list                  Set custom DNS search domains (default [])
29 29
       --endpoint-mode string             Endpoint mode (vip or dnsrr)
30
-  -e, --env value                        Set environment variables (default [])
31
-      --env-file value                   Read in a file of environment variables (default [])
32
-      --group value                      Set one or more supplementary user groups for the container (default [])
30
+  -e, --env list                         Set environment variables (default [])
31
+      --env-file list                    Read in a file of environment variables (default [])
32
+      --group list                       Set one or more supplementary user groups for the container (default [])
33 33
       --health-cmd string                Command to run to check health
34
-      --health-interval duration         Time between running the check (ns|us|ms|s|m|h) (default 0s)
34
+      --health-interval duration         Time between running the check (default none)
35 35
       --health-retries int               Consecutive failures needed to report unhealthy
36
-      --health-timeout duration          Maximum time to allow one check to run (ns|us|ms|s|m|h) (default 0s)
36
+      --health-timeout duration          Maximum time to allow one check to run (default none)
37 37
       --help                             Print usage
38
-      --hostname                         Service containers hostname
39
-  -l, --label value                      Service labels (default [])
40
-      --limit-cpu value                  Limit CPUs (default 0.000)
41
-      --limit-memory value               Limit Memory (default 0 B)
38
+      --hostname string                  Container hostname
39
+  -l, --label list                       Service labels (default [])
40
+      --limit-cpu decimal                Limit CPUs (default 0.000)
41
+      --limit-memory bytes               Limit Memory (default 0 B)
42 42
       --log-driver string                Logging driver for service
43
-      --log-opt value                    Logging driver options (default [])
43
+      --log-opt list                     Logging driver options (default [])
44 44
       --mode string                      Service mode (replicated or global) (default "replicated")
45
-      --mount value                      Attach a filesystem mount to the service
45
+      --mount mount                      Attach a filesystem mount to the service
46 46
       --name string                      Service name
47
-      --network value                    Network attachments (default [])
47
+      --network list                     Network attachments (default [])
48 48
       --no-healthcheck                   Disable any container-specified HEALTHCHECK
49
-  -p, --publish value                    Publish a port as a node port (default [])
50
-      --replicas value                   Number of tasks (default none)
51
-      --reserve-cpu value                Reserve CPUs (default 0.000)
52
-      --reserve-memory value             Reserve Memory (default 0 B)
49
+  -p, --publish list                     Publish a port as a node port (default [])
50
+      --replicas uint                    Number of tasks (default none)
51
+      --reserve-cpu decimal              Reserve CPUs (default 0.000)
52
+      --reserve-memory bytes             Reserve Memory (default 0 B)
53 53
       --restart-condition string         Restart when condition is met (none, on-failure, or any)
54
-      --restart-delay value              Delay between restart attempts (default none)
55
-      --restart-max-attempts value       Maximum number of restarts before giving up (default none)
56
-      --restart-window value             Window used to evaluate the restart policy (default none)
57
-      --stop-grace-period value          Time to wait before force killing a container (default none)
54
+      --restart-delay duration           Delay between restart attempts (default none)
55
+      --restart-max-attempts uint        Maximum number of restarts before giving up (default none)
56
+      --restart-window duration          Window used to evaluate the restart policy (default none)
57
+      --stop-grace-period duration       Time to wait before force killing a container (default none)
58 58
   -t, --tty                              Allocate a pseudo-TTY
59 59
       --update-delay duration            Delay between updates (ns|us|ms|s|m|h) (default 0s)
60 60
       --update-failure-action string     Action on update failure (pause|continue) (default "pause")
61
-      --update-max-failure-ratio value   Failure rate to tolerate during an update
61
+      --update-max-failure-ratio float   Failure rate to tolerate during an update
62 62
       --update-monitor duration          Duration after each task update to monitor for failure (ns|us|ms|s|m|h) (default 0s)
63 63
       --update-parallelism uint          Maximum number of tasks updated simultaneously (0 to update all at once) (default 1)
64 64
   -u, --user string                      Username or UID (format: <name|uid>[:<group|gid>])
65
-      --with-registry-auth               Send registry authentication details to Swarm agents
65
+      --with-registry-auth               Send registry authentication details to swarm agents
66 66
   -w, --workdir string                   Working directory inside the container
67 67
 ```
68 68
 
... ...
@@ -21,58 +21,58 @@ 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 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
-      --dns-add list                       Add or update custom DNS servers (default [])
30
-      --dns-options-add list               Add or update DNS options (default [])
31
-      --dns-options-rm list                Remove DNS options (default [])
32
-      --dns-rm list                        Remove custom DNS servers (default [])
33
-      --dns-search-add list                Add or update custom DNS search domains (default [])
34
-      --dns-search-rm list                 Remove DNS search domains (default [])
35
-      --endpoint-mode string               Endpoint mode (vip or dnsrr)
36
-      --env-add list                       Add or update an environment variable (default [])
37
-      --env-rm list                        Remove an environment variable (default [])
38
-      --force                              Force update even if no changes require it
39
-      --group-add stringSlice              Add an additional supplementary user group to the container
40
-      --group-rm list                      Remove a previously added supplementary user group from the container (default [])
41
-      --health-cmd string                  Command to run to check health
42
-      --health-interval duration           Time between running the check (ns|us|ms|s|m|h) (default 0s)
43
-      --health-retries int                 Consecutive failures needed to report unhealthy
44
-      --health-timeout duration            Maximum time to allow one check to run (ns|us|ms|s|m|h) (default 0s)
45
-      --help                               Print usage
46
-      --image string                       Service image tag
47
-      --label-add list                     Add or update a service label (default [])
48
-      --label-rm list                      Remove a label by its key (default [])
49
-      --limit-cpu NanoCPUs                 Limit CPUs (default 0.000)
50
-      --limit-memory MemoryBytes           Limit Memory (default 0 B)
51
-      --log-driver string                  Logging driver for service
52
-      --log-opt list                       Logging driver options (default [])
53
-      --mount-add mount                    Add or update a mount on a service
54
-      --mount-rm list                      Remove a mount by its target path (default [])
55
-      --no-healthcheck                     Disable any container-specified HEALTHCHECK
56
-      --publish-add list                   Add or update a published port (default [])
57
-      --publish-rm list                    Remove a published port by its target port (default [])
58
-      --replicas uint64-ptr                Number of tasks (default none)
59
-      --reserve-cpu NanoCPUs               Reserve CPUs (default 0.000)
60
-      --reserve-memory MemoryBytes         Reserve Memory (default 0 B)
61
-      --restart-condition string           Restart when condition is met (none, on-failure, or any)
62
-      --restart-delay duration-ptr         Delay between restart attempts (default none)
63
-      --restart-max-attempts uint64-ptr    Maximum number of restarts before giving up (default none)
64
-      --restart-window duration-ptr        Window used to evaluate the restart policy (default none)
65
-      --rollback                           Rollback to previous specification
66
-      --stop-grace-period duration-ptr     Time to wait before force killing a container (default none)
67
-  -t, --tty                                Allocate a pseudo-TTY
68
-      --update-delay duration              Delay between updates (ns|us|ms|s|m|h) (default 0s)
69
-      --update-failure-action string       Action on update failure (pause|continue) (default "pause")
70
-      --update-max-failure-ratio float32   Failure rate to tolerate during an update
71
-      --update-monitor duration            Duration after each task update to monitor for failure (ns|us|ms|s|m|h) (default 0s)
72
-      --update-parallelism uint            Maximum number of tasks updated simultaneously (0 to update all at once) (default 1)
73
-  -u, --user string                        Username or UID (format: <name|uid>[:<group|gid>])
74
-      --with-registry-auth                 Send registry authentication details to swarm agents
75
-  -w, --workdir string                     Working directory inside the container
24
+      --args string                      Service command args
25
+      --constraint-add list              Add or update a placement constraint (default [])
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
+      --dns-add list                     Add or update custom DNS servers (default [])
30
+      --dns-options-add list             Add or update DNS options (default [])
31
+      --dns-options-rm list              Remove DNS options (default [])
32
+      --dns-rm list                      Remove custom DNS servers (default [])
33
+      --dns-search-add list              Add or update custom DNS search domains (default [])
34
+      --dns-search-rm list               Remove DNS search domains (default [])
35
+      --endpoint-mode string             Endpoint mode (vip or dnsrr)
36
+      --env-add list                     Add or update an environment variable (default [])
37
+      --env-rm list                      Remove an environment variable (default [])
38
+      --force                            Force update even if no changes require it
39
+      --group-add list                   Add an additional supplementary user group to the container (default [])
40
+      --group-rm list                    Remove a previously added supplementary user group from the container (default [])
41
+      --health-cmd string                Command to run to check health
42
+      --health-interval duration         Time between running the check (default none)
43
+      --health-retries int               Consecutive failures needed to report unhealthy
44
+      --health-timeout duration          Maximum time to allow one check to run (default none)
45
+      --help                             Print usage
46
+      --image string                     Service image tag
47
+      --label-add list                   Add or update a service label (default [])
48
+      --label-rm list                    Remove a label by its key (default [])
49
+      --limit-cpu decimal                Limit CPUs (default 0.000)
50
+      --limit-memory bytes               Limit Memory (default 0 B)
51
+      --log-driver string                Logging driver for service
52
+      --log-opt list                     Logging driver options (default [])
53
+      --mount-add mount                  Add or update a mount on a service
54
+      --mount-rm list                    Remove a mount by its target path (default [])
55
+      --no-healthcheck                   Disable any container-specified HEALTHCHECK
56
+      --publish-add list                 Add or update a published port (default [])
57
+      --publish-rm list                  Remove a published port by its target port (default [])
58
+      --replicas uint                    Number of tasks (default none)
59
+      --reserve-cpu decimal              Reserve CPUs (default 0.000)
60
+      --reserve-memory bytes             Reserve Memory (default 0 B)
61
+      --restart-condition string         Restart when condition is met (none, on-failure, or any)
62
+      --restart-delay duration           Delay between restart attempts (default none)
63
+      --restart-max-attempts uint        Maximum number of restarts before giving up (default none)
64
+      --restart-window duration          Window used to evaluate the restart policy (default none)
65
+      --rollback                         Rollback to previous specification
66
+      --stop-grace-period duration       Time to wait before force killing a container (default none)
67
+  -t, --tty                              Allocate a pseudo-TTY
68
+      --update-delay duration            Delay between updates (ns|us|ms|s|m|h) (default 0s)
69
+      --update-failure-action string     Action on update failure (pause|continue) (default "pause")
70
+      --update-max-failure-ratio float   Failure rate to tolerate during an update
71
+      --update-monitor duration          Duration after each task update to monitor for failure (ns|us|ms|s|m|h) (default 0s)
72
+      --update-parallelism uint          Maximum number of tasks updated simultaneously (0 to update all at once) (default 1)
73
+  -u, --user string                      Username or UID (format: <name|uid>[:<group|gid>])
74
+      --with-registry-auth               Send registry authentication details to swarm agents
75
+  -w, --workdir string                   Working directory inside the container
76 76
 ```
77 77
 
78 78
 Updates a service as described by the specified parameters. This command has to be run targeting a manager node.
... ...
@@ -345,7 +345,7 @@ func (c *NanoCPUs) Set(value string) error {
345 345
 
346 346
 // Type returns the type
347 347
 func (c *NanoCPUs) Type() string {
348
-	return "NanoCPUs"
348
+	return "decimal"
349 349
 }
350 350
 
351 351
 // Value returns the value in int64