1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

Improvement for docker subcommand's help messages

Signed-off-by: Wen Cheng Ma <wenchma@cn.ibm.com>
This commit is contained in:
Wen Cheng Ma 2015-12-03 15:16:53 +08:00
parent 102eb03c68
commit d7dc439623
4 changed files with 20 additions and 16 deletions

View file

@ -15,7 +15,15 @@ parent = "smn_cli"
List containers List containers
-a, --all Show all containers (default shows just running) -a, --all Show all containers (default shows just running)
-f, --filter=[] Filter output based on conditions provided -f, --filter=[] Filter output based on these conditions:
- exited=<int> an exit code of <int>
- label=<key> or label=<key>=<value>
- status=(created|restarting|running|paused|exited)
- name=<string> a container's name
- id=<ID> a container's ID
- before=(<container-name>|<container-id>)
- since=(<container-name>|<container-id>)
- ancestor=(<image-name>[:tag]|<image-id>|<image@digest>) - containers created from an image or a descendant.
--format=[] Pretty-print containers using a Go template --format=[] Pretty-print containers using a Go template
--help Print usage --help Print usage
-l, --latest Show the latest created container (includes all states) -l, --latest Show the latest created container (includes all states)

View file

@ -26,16 +26,15 @@ the running containers.
Show all containers. Only running containers are shown by default. The default is *false*. Show all containers. Only running containers are shown by default. The default is *false*.
**-f**, **--filter**=[] **-f**, **--filter**=[]
Provide filter values. Valid filters: Filter output based on these conditions:
exited=<int> - containers with exit code of <int> - exited=<int> an exit code of <int>
label=<key> or label=<key>=<value> - label=<key> or label=<key>=<value>
status=(created|restarting|running|paused|exited) - status=(created|restarting|running|paused|exited)
name=<string> - container's name - name=<string> a container's name
id=<ID> - container's ID - id=<ID> a container's ID
before=(<container-name>|<container-id>) - before=(<container-name>|<container-id>)
since=(<container-name>|<container-id>) - since=(<container-name>|<container-id>)
ancestor=(<image-name>[:tag]|<image-id>|<image@digest>) - filters containers that were - ancestor=(<image-name>[:tag]|<image-id>|<image@digest>) - containers created from an image or a descendant.
created from the given image or a descendant.
**--format**="*TEMPLATE*" **--format**="*TEMPLATE*"
Pretty-print containers using a Go template. Pretty-print containers using a Go template.

View file

@ -571,10 +571,7 @@ func (fs *FlagSet) PrintDefaults() {
format := " -%s=%s" format := " -%s=%s"
fmt.Fprintf(writer, format, strings.Join(names, ", -"), val) fmt.Fprintf(writer, format, strings.Join(names, ", -"), val)
} }
for i, line := range strings.Split(flag.Usage, "\n") { for _, line := range strings.Split(flag.Usage, "\n") {
if i != 0 {
line = " " + line
}
fmt.Fprintln(writer, "\t", line) fmt.Fprintln(writer, "\t", line)
} }
} }

View file

@ -104,7 +104,7 @@ func Parse(cmd *flag.FlagSet, args []string) (*container.Config, *container.Host
flCpusetMems = cmd.String([]string{"-cpuset-mems"}, "", "MEMs in which to allow execution (0-3, 0,1)") flCpusetMems = cmd.String([]string{"-cpuset-mems"}, "", "MEMs in which to allow execution (0-3, 0,1)")
flBlkioWeight = cmd.Uint16([]string{"-blkio-weight"}, 0, "Block IO (relative weight), between 10 and 1000") flBlkioWeight = cmd.Uint16([]string{"-blkio-weight"}, 0, "Block IO (relative weight), between 10 and 1000")
flSwappiness = cmd.Int64([]string{"-memory-swappiness"}, -1, "Tune container memory swappiness (0 to 100)") flSwappiness = cmd.Int64([]string{"-memory-swappiness"}, -1, "Tune container memory swappiness (0 to 100)")
flNetMode = cmd.String([]string{"-net"}, "default", "Set the Network for the container") flNetMode = cmd.String([]string{"-net"}, "default", "Connect a container to a network")
flMacAddress = cmd.String([]string{"-mac-address"}, "", "Container MAC address (e.g. 92:d0:c6:0a:29:33)") flMacAddress = cmd.String([]string{"-mac-address"}, "", "Container MAC address (e.g. 92:d0:c6:0a:29:33)")
flIpcMode = cmd.String([]string{"-ipc"}, "", "IPC namespace to use") flIpcMode = cmd.String([]string{"-ipc"}, "", "IPC namespace to use")
flRestartPolicy = cmd.String([]string{"-restart"}, "no", "Restart policy to apply when a container exits") flRestartPolicy = cmd.String([]string{"-restart"}, "no", "Restart policy to apply when a container exits")