summaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
authorJhon Honce <jhonce@redhat.com>2021-09-17 15:05:51 -0700
committerJhon Honce <jhonce@redhat.com>2021-09-20 13:51:27 -0700
commit8453c8ce63b6ec3799f67198fd7119add67722d6 (patch)
tree37fc3f7acb526c8fbc76e75674825aa5949f0d58 /cmd
parent7e8ce73c15036d50fc31f763c903c264392f1e04 (diff)
downloadpodman-8453c8ce63b6ec3799f67198fd7119add67722d6.tar.gz
podman-8453c8ce63b6ec3799f67198fd7119add67722d6.tar.bz2
podman-8453c8ce63b6ec3799f67198fd7119add67722d6.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')
-rw-r--r--cmd/podman/containers/ps.go8
1 files changed, 6 insertions, 2 deletions
diff --git a/cmd/podman/containers/ps.go b/cmd/podman/containers/ps.go
index ff792b78b..afb8edd91 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",
})