From 8ebeadc3c68d0291e9de6ce4b6fedf17f362129f Mon Sep 17 00:00:00 2001 From: Daniel J Walsh Date: Tue, 20 Apr 2021 10:03:49 -0400 Subject: Add --noheading flag to all list commands Currently we have only podman images list --noheading. This PR Adds this option to volumes, containers, pods, networks, machines, and secrets. Fixes: https://github.com/containers/podman/issues/10065 Signed-off-by: Daniel J Walsh --- cmd/podman/pods/ps.go | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'cmd/podman/pods') diff --git a/cmd/podman/pods/ps.go b/cmd/podman/pods/ps.go index aeba80525..a4b6d1afa 100644 --- a/cmd/podman/pods/ps.go +++ b/cmd/podman/pods/ps.go @@ -63,6 +63,7 @@ func init() { flags.StringVar(&psInput.Format, formatFlagName, "", "Pretty-print pods to JSON or using a Go template") _ = psCmd.RegisterFlagCompletionFunc(formatFlagName, common.AutocompleteJSONFormat) + flags.Bool("noheading", false, "Do not print headers") flags.BoolVar(&psInput.Namespace, "namespace", false, "Display namespace information of the pod") flags.BoolVar(&psInput.Namespace, "ns", false, "Display namespace information of the pod") flags.BoolVar(&noTrunc, "no-trunc", false, "Do not truncate pod and container IDs") @@ -134,6 +135,10 @@ func pods(cmd *cobra.Command, _ []string) error { renderHeaders = parse.HasTable(psInput.Format) row = report.NormalizeFormat(psInput.Format) } + noHeading, _ := cmd.Flags().GetBool("noheading") + if noHeading { + renderHeaders = false + } format := parse.EnforceRange(row) tmpl, err := template.New("listPods").Parse(format) -- cgit v1.2.3-54-g00ecf