From 8453c8ce63b6ec3799f67198fd7119add67722d6 Mon Sep 17 00:00:00 2001 From: Jhon Honce Date: Fri, 17 Sep 2021 15:05:51 -0700 Subject: 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 --- cmd/podman/containers/ps.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'cmd') 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", }) -- cgit v1.2.3-54-g00ecf