Browse code

Improvement for docker subcommand's help messages

Signed-off-by: Wen Cheng Ma <wenchma@cn.ibm.com>

Wen Cheng Ma authored on 2015/12/03 16:16:53
Showing 4 changed files
... ...
@@ -15,7 +15,15 @@ parent = "smn_cli"
15 15
     List containers
16 16
 
17 17
       -a, --all             Show all containers (default shows just running)
18
-      -f, --filter=[]       Filter output based on conditions provided
18
+      -f, --filter=[]       Filter output based on these conditions:
19
+                            - exited=<int> an exit code of <int>
20
+                            - label=<key> or label=<key>=<value>
21
+                            - status=(created|restarting|running|paused|exited)
22
+                            - name=<string> a container's name
23
+                            - id=<ID> a container's ID
24
+                            - before=(<container-name>|<container-id>)
25
+                            - since=(<container-name>|<container-id>)
26
+                            - ancestor=(<image-name>[:tag]|<image-id>|<image@digest>) - containers created from an image or a descendant.
19 27
       --format=[]           Pretty-print containers using a Go template
20 28
       --help                Print usage
21 29
       -l, --latest          Show the latest created container (includes all states)
... ...
@@ -26,16 +26,15 @@ the running containers.
26 26
    Show all containers. Only running containers are shown by default. The default is *false*.
27 27
 
28 28
 **-f**, **--filter**=[]
29
-   Provide filter values. Valid filters:
30
-                          exited=<int> - containers with exit code of <int>
31
-                          label=<key> or label=<key>=<value>
32
-                          status=(created|restarting|running|paused|exited)
33
-                          name=<string> - container's name
34
-                          id=<ID> - container's ID
35
-                          before=(<container-name>|<container-id>)
36
-                          since=(<container-name>|<container-id>)
37
-                          ancestor=(<image-name>[:tag]|<image-id>|<image@digest>) - filters containers that were
38
-                          created from the given image or a descendant.
29
+   Filter output based on these conditions:
30
+   - exited=<int> an exit code of <int>
31
+   - label=<key> or label=<key>=<value>
32
+   - status=(created|restarting|running|paused|exited)
33
+   - name=<string> a container's name
34
+   - id=<ID> a container's ID
35
+   - before=(<container-name>|<container-id>)
36
+   - since=(<container-name>|<container-id>)
37
+   - ancestor=(<image-name>[:tag]|<image-id>|<image@digest>) - containers created from an image or a descendant.
39 38
 
40 39
 **--format**="*TEMPLATE*"
41 40
    Pretty-print containers using a Go template.
... ...
@@ -571,10 +571,7 @@ func (fs *FlagSet) PrintDefaults() {
571 571
 				format := "  -%s=%s"
572 572
 				fmt.Fprintf(writer, format, strings.Join(names, ", -"), val)
573 573
 			}
574
-			for i, line := range strings.Split(flag.Usage, "\n") {
575
-				if i != 0 {
576
-					line = "  " + line
577
-				}
574
+			for _, line := range strings.Split(flag.Usage, "\n") {
578 575
 				fmt.Fprintln(writer, "\t", line)
579 576
 			}
580 577
 		}
... ...
@@ -104,7 +104,7 @@ func Parse(cmd *flag.FlagSet, args []string) (*container.Config, *container.Host
104 104
 		flCpusetMems        = cmd.String([]string{"-cpuset-mems"}, "", "MEMs in which to allow execution (0-3, 0,1)")
105 105
 		flBlkioWeight       = cmd.Uint16([]string{"-blkio-weight"}, 0, "Block IO (relative weight), between 10 and 1000")
106 106
 		flSwappiness        = cmd.Int64([]string{"-memory-swappiness"}, -1, "Tune container memory swappiness (0 to 100)")
107
-		flNetMode           = cmd.String([]string{"-net"}, "default", "Set the Network for the container")
107
+		flNetMode           = cmd.String([]string{"-net"}, "default", "Connect a container to a network")
108 108
 		flMacAddress        = cmd.String([]string{"-mac-address"}, "", "Container MAC address (e.g. 92:d0:c6:0a:29:33)")
109 109
 		flIpcMode           = cmd.String([]string{"-ipc"}, "", "IPC namespace to use")
110 110
 		flRestartPolicy     = cmd.String([]string{"-restart"}, "no", "Restart policy to apply when a container exits")