From d7dc439623ff18d2a8dd152dbb032a307100cb2e Mon Sep 17 00:00:00 2001 From: Wen Cheng Ma Date: Thu, 3 Dec 2015 15:16:53 +0800 Subject: [PATCH] Improvement for docker subcommand's help messages Signed-off-by: Wen Cheng Ma --- docs/reference/commandline/ps.md | 10 +++++++++- man/docker-ps.1.md | 19 +++++++++---------- pkg/mflag/flag.go | 5 +---- runconfig/parse.go | 2 +- 4 files changed, 20 insertions(+), 16 deletions(-) diff --git a/docs/reference/commandline/ps.md b/docs/reference/commandline/ps.md index 213648f1db..432a9a31c4 100644 --- a/docs/reference/commandline/ps.md +++ b/docs/reference/commandline/ps.md @@ -15,7 +15,15 @@ parent = "smn_cli" List containers -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= an exit code of + - label= or label== + - status=(created|restarting|running|paused|exited) + - name= a container's name + - id= a container's ID + - before=(|) + - since=(|) + - ancestor=([:tag]||) - containers created from an image or a descendant. --format=[] Pretty-print containers using a Go template --help Print usage -l, --latest Show the latest created container (includes all states) diff --git a/man/docker-ps.1.md b/man/docker-ps.1.md index 770cd26498..0d0cae5792 100644 --- a/man/docker-ps.1.md +++ b/man/docker-ps.1.md @@ -26,16 +26,15 @@ the running containers. Show all containers. Only running containers are shown by default. The default is *false*. **-f**, **--filter**=[] - Provide filter values. Valid filters: - exited= - containers with exit code of - label= or label== - status=(created|restarting|running|paused|exited) - name= - container's name - id= - container's ID - before=(|) - since=(|) - ancestor=([:tag]||) - filters containers that were - created from the given image or a descendant. + Filter output based on these conditions: + - exited= an exit code of + - label= or label== + - status=(created|restarting|running|paused|exited) + - name= a container's name + - id= a container's ID + - before=(|) + - since=(|) + - ancestor=([:tag]||) - containers created from an image or a descendant. **--format**="*TEMPLATE*" Pretty-print containers using a Go template. diff --git a/pkg/mflag/flag.go b/pkg/mflag/flag.go index ddcd62c1c7..ac3cfc1851 100644 --- a/pkg/mflag/flag.go +++ b/pkg/mflag/flag.go @@ -571,10 +571,7 @@ func (fs *FlagSet) PrintDefaults() { format := " -%s=%s" fmt.Fprintf(writer, format, strings.Join(names, ", -"), val) } - for i, line := range strings.Split(flag.Usage, "\n") { - if i != 0 { - line = " " + line - } + for _, line := range strings.Split(flag.Usage, "\n") { fmt.Fprintln(writer, "\t", line) } } diff --git a/runconfig/parse.go b/runconfig/parse.go index c21d2a3e09..b2c0f35651 100644 --- a/runconfig/parse.go +++ b/runconfig/parse.go @@ -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)") 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)") - 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)") flIpcMode = cmd.String([]string{"-ipc"}, "", "IPC namespace to use") flRestartPolicy = cmd.String([]string{"-restart"}, "no", "Restart policy to apply when a container exits")