diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2020-11-23 19:09:45 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-23 19:09:45 +0100 |
commit | 10c2c839c03e8eed799ccadd99fa8a962754255b (patch) | |
tree | ed3c268d7ab175e5d6964c02b17ec0a9a78fa840 /cmd | |
parent | dd343418ce5a3fd6c6238d7e2edc132826756051 (diff) | |
parent | c901a766fb66564df24538f761f895212168c923 (diff) | |
download | podman-10c2c839c03e8eed799ccadd99fa8a962754255b.tar.gz podman-10c2c839c03e8eed799ccadd99fa8a962754255b.tar.bz2 podman-10c2c839c03e8eed799ccadd99fa8a962754255b.zip |
Merge pull request #8446 from Luap99/podman-container-ps
Add podman container ps command
Diffstat (limited to 'cmd')
-rw-r--r-- | cmd/podman/containers/ps.go | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/cmd/podman/containers/ps.go b/cmd/podman/containers/ps.go index a1a41ae08..6f84cf9b8 100644 --- a/cmd/podman/containers/ps.go +++ b/cmd/podman/containers/ps.go @@ -29,15 +29,25 @@ var ( psDescription = "Prints out information about the containers" psCommand = &cobra.Command{ Use: "ps [options]", - Args: validate.NoArgs, Short: "List containers", Long: psDescription, RunE: ps, + Args: validate.NoArgs, ValidArgsFunction: completion.AutocompleteNone, Example: `podman ps -a podman ps -a --format "{{.ID}} {{.Image}} {{.Labels}} {{.Mounts}}" podman ps --size --sort names`, } + + psContainerCommand = &cobra.Command{ + Use: psCommand.Use, + Short: psCommand.Short, + Long: psCommand.Long, + RunE: psCommand.RunE, + Args: psCommand.Args, + ValidArgsFunction: psCommand.ValidArgsFunction, + Example: strings.ReplaceAll(psCommand.Example, "podman ps", "podman container ps"), + } ) var ( listOpts = entities.ContainerListOptions{ @@ -54,6 +64,14 @@ func init() { }) listFlagSet(psCommand) validate.AddLatestFlag(psCommand, &listOpts.Latest) + + registry.Commands = append(registry.Commands, registry.CliCommand{ + Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode}, + Command: psContainerCommand, + Parent: containerCmd, + }) + listFlagSet(psContainerCommand) + validate.AddLatestFlag(psContainerCommand, &listOpts.Latest) } func listFlagSet(cmd *cobra.Command) { |