From 1f8c72b79cd4335a680dde5c9b3c713833fd9d24 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 Upstream-commit: fb4672c52c050ce08c7432d2d149e37b0056e8f6 Component: engine --- components/engine/commands.go | 2 +- components/engine/docs/sources/commandline/cli.rst | 2 +- components/engine/server.go | 6 +++++- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/components/engine/commands.go b/components/engine/commands.go index 4a7c4b8d23..a8eae4476f 100644 --- a/components/engine/commands.go +++ b/components/engine/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/components/engine/docs/sources/commandline/cli.rst b/components/engine/docs/sources/commandline/cli.rst index 6efa9b1ebb..cb4d6698e6 100644 --- a/components/engine/docs/sources/commandline/cli.rst +++ b/components/engine/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/components/engine/server.go b/components/engine/server.go index 2cb6771178..b3845bd79c 100644 --- a/components/engine/server.go +++ b/components/engine/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