From fb4672c52c050ce08c7432d2d149e37b0056e8f6 Mon Sep 17 00:00:00 2001 From: Victor Vieux Date: Tue, 29 Oct 2013 19:03:41 -0700 Subject: [PATCH] do not split last column docker top --- commands.go | 2 +- docs/sources/commandline/cli.rst | 2 +- server.go | 6 +++++- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/commands.go b/commands.go index 4a7c4b8d23..a8eae4476f 100644 --- a/commands.go +++ b/commands.go @@ -682,7 +682,7 @@ func (cli *DockerCli) CmdInspect(args ...string) error { } func (cli *DockerCli) CmdTop(args ...string) error { - cmd := Subcmd("top", "CONTAINER", "Lookup the running processes of a container") + cmd := Subcmd("top", "CONTAINER [ps OPTIONS]", "Lookup the running processes of a container") if err := cmd.Parse(args); err != nil { return nil } diff --git a/docs/sources/commandline/cli.rst b/docs/sources/commandline/cli.rst index 6efa9b1ebb..cb4d6698e6 100644 --- a/docs/sources/commandline/cli.rst +++ b/docs/sources/commandline/cli.rst @@ -728,7 +728,7 @@ to the newly created container. :: - Usage: docker top CONTAINER + Usage: docker top CONTAINER [ps OPTIONS] Lookup the running processes of a container diff --git a/server.go b/server.go index 2cb6771178..b3845bd79c 100644 --- a/server.go +++ b/server.go @@ -350,7 +350,11 @@ func (srv *Server) ContainerTop(name, ps_args string) (*APITop, error) { } // no scanner.Text because we skip container id for scanner.Scan() { - words = append(words, scanner.Text()) + if i != 0 && len(words) == len(procs.Titles) { + words[len(words)-1] = fmt.Sprintf("%s %s", words[len(words)-1], scanner.Text()) + } else { + words = append(words, scanner.Text()) + } } if i == 0 { procs.Titles = words