diff options
author | Valentin Rothberg <rothberg@redhat.com> | 2019-04-29 11:21:55 +0200 |
---|---|---|
committer | Valentin Rothberg <rothberg@redhat.com> | 2019-05-03 11:20:16 +0200 |
commit | 0d2d52339058a19e66ecc75f78c52596054c7dad (patch) | |
tree | 73636772d105d249a996ee145b0afd48fddf16ab /cmd | |
parent | d9d9c82184ad6d7e3fad07dfe2e99b158560d3a8 (diff) | |
download | podman-0d2d52339058a19e66ecc75f78c52596054c7dad.tar.gz podman-0d2d52339058a19e66ecc75f78c52596054c7dad.tar.bz2 podman-0d2d52339058a19e66ecc75f78c52596054c7dad.zip |
top: fallback to execing ps(1)
Fallback to executing ps(1) in case we hit an unknown psgo descriptor.
This ensures backwards compatibility with docker-top, which was purely
ps(1) driven.
Also support comma-separated descriptors as input.
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
Diffstat (limited to 'cmd')
-rw-r--r-- | cmd/podman/top.go | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/cmd/podman/top.go b/cmd/podman/top.go index 2e0a22d92..8583eccb5 100644 --- a/cmd/podman/top.go +++ b/cmd/podman/top.go @@ -33,7 +33,7 @@ var ( %s`, getDescriptorString()) _topCommand = &cobra.Command{ - Use: "top [flags] CONTAINER [FORMAT-DESCRIPTORS]", + Use: "top [flags] CONTAINER [FORMAT-DESCRIPTORS|ARGS]", Short: "Display the running processes of a container", Long: topDescription, RunE: func(cmd *cobra.Command, args []string) error { @@ -42,9 +42,11 @@ var ( topCommand.Remote = remoteclient return topCmd(&topCommand) }, + Args: cobra.ArbitraryArgs, Example: `podman top ctrID - podman top --latest - podman top ctrID pid seccomp args %C`, +podman top --latest +podman top ctrID pid seccomp args %C +podman top ctrID -eo user,pid,comm`, } ) @@ -53,6 +55,7 @@ func init() { topCommand.SetHelpTemplate(HelpTemplate()) topCommand.SetUsageTemplate(UsageTemplate()) flags := topCommand.Flags() + flags.SetInterspersed(false) flags.BoolVar(&topCommand.ListDescriptors, "list-descriptors", false, "") flags.MarkHidden("list-descriptors") flags.BoolVarP(&topCommand.Latest, "latest", "l", false, "Act on the latest container podman is aware of") |