diff options
author | Jhon Honce <jhonce@redhat.com> | 2021-09-17 15:05:51 -0700 |
---|---|---|
committer | Matthew Heon <matthew.heon@pm.me> | 2021-09-22 16:29:44 -0400 |
commit | 70a4286626b6d418f4b4a969af42bde85aa1a09f (patch) | |
tree | ea113fb69140ef6384efe6daad8b815461241205 /cmd/podman | |
parent | 45f8b01f678fd289547aa02d342ce208f08f0558 (diff) | |
download | podman-70a4286626b6d418f4b4a969af42bde85aa1a09f.tar.gz podman-70a4286626b6d418f4b4a969af42bde85aa1a09f.tar.bz2 podman-70a4286626b6d418f4b4a969af42bde85aa1a09f.zip |
Support --format tables in ps output
- Added tests to help ensure there is no future regressions
- Added WaitWithTimeout(int) rather than calling
WaitWithDefaultTimeout() multiple times
- Exposed DefaultWaitTimeout to allow test to use a multiplier
Fixes #2221
Signed-off-by: Jhon Honce <jhonce@redhat.com>
Diffstat (limited to 'cmd/podman')
-rw-r--r-- | cmd/podman/containers/ps.go | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/cmd/podman/containers/ps.go b/cmd/podman/containers/ps.go index a5b0795cd..2566c57de 100644 --- a/cmd/podman/containers/ps.go +++ b/cmd/podman/containers/ps.go @@ -221,7 +221,10 @@ func ps(cmd *cobra.Command, _ []string) error { } hdrs, format := createPsOut() + + noHeading, _ := cmd.Flags().GetBool("noheading") if cmd.Flags().Changed("format") { + noHeading = noHeading || !report.HasTable(listOpts.Format) format = report.NormalizeFormat(listOpts.Format) format = report.EnforceRange(format) } @@ -240,8 +243,7 @@ func ps(cmd *cobra.Command, _ []string) error { defer w.Flush() headers := func() error { return nil } - noHeading, _ := cmd.Flags().GetBool("noheading") - if !(noHeading || listOpts.Quiet || cmd.Flags().Changed("format")) { + if !noHeading { headers = func() error { return tmpl.Execute(w, hdrs) } @@ -298,9 +300,11 @@ func createPsOut() ([]map[string]string, string) { "IPC": "ipc", "MNT": "mnt", "NET": "net", + "Networks": "networks", "PIDNS": "pidns", "Pod": "pod id", "PodName": "podname", // undo camelcase space break + "RunningFor": "running for", "UTS": "uts", "User": "userns", }) |