Add format descriptors infor to podman top

Trying to play with podman top, I had a hard time
finding info on format options.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>

Closes: #1134
Approved by: umohnani8
This commit is contained in:
Daniel J Walsh
2018-07-23 10:00:11 -04:00
committed by Atomic Bot
parent 8f48e60840
commit 2c11e38b24
2 changed files with 15 additions and 2 deletions

View File

@ -12,6 +12,16 @@ import (
"github.com/urfave/cli" "github.com/urfave/cli"
) )
func getDescriptorString() string {
descriptors, err := libpod.GetContainerPidInformationDescriptors()
if err == nil {
return fmt.Sprintf(`
Format Descriptors:
%s`, strings.Join(descriptors, ","))
}
return ""
}
var ( var (
topFlags = []cli.Flag{ topFlags = []cli.Flag{
LatestFlag, LatestFlag,
@ -20,11 +30,12 @@ var (
Hidden: true, Hidden: true,
}, },
} }
topDescription = `Display the running processes of the container. Specify format descriptors topDescription = fmt.Sprintf(`Display the running processes of the container. Specify format descriptors
to alter the output. You may run "podman top -l pid pcpu seccomp" to print to alter the output. You may run "podman top -l pid pcpu seccomp" to print
the process ID, the CPU percentage and the seccomp mode of each process of the process ID, the CPU percentage and the seccomp mode of each process of
the latest container. the latest container.
` %s
`, getDescriptorString())
topCommand = cli.Command{ topCommand = cli.Command{
Name: "top", Name: "top",

View File

@ -24,6 +24,8 @@ to run containers such as CRI-O, the last started container could be from either
The following descriptors are supported in addition to the AIX format descriptors mentioned in ps (1): The following descriptors are supported in addition to the AIX format descriptors mentioned in ps (1):
**pcpu, group, ppid, user, args, comm, rgroup, nice, pid, pgid, etime, ruser, time, tty, vsz**
**capinh** **capinh**
Set of inheritable capabilities. See capabilities (7) for more information. Set of inheritable capabilities. See capabilities (7) for more information.