diff options
author | Daniel J Walsh <dwalsh@redhat.com> | 2021-04-20 10:03:49 -0400 |
---|---|---|
committer | Daniel J Walsh <dwalsh@redhat.com> | 2021-04-21 05:22:29 -0400 |
commit | 8ebeadc3c68d0291e9de6ce4b6fedf17f362129f (patch) | |
tree | aeae2fc2bf053e43ca03a7b178cd65f99ce3f040 /cmd/podman/volumes/list.go | |
parent | 0d3aa18f04aa72d23ddec1dac779c18ffb71cfb3 (diff) | |
download | podman-8ebeadc3c68d0291e9de6ce4b6fedf17f362129f.tar.gz podman-8ebeadc3c68d0291e9de6ce4b6fedf17f362129f.tar.bz2 podman-8ebeadc3c68d0291e9de6ce4b6fedf17f362129f.zip |
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 <dwalsh@redhat.com>
Diffstat (limited to 'cmd/podman/volumes/list.go')
-rw-r--r-- | cmd/podman/volumes/list.go | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/cmd/podman/volumes/list.go b/cmd/podman/volumes/list.go index e04f452d4..0d764e988 100644 --- a/cmd/podman/volumes/list.go +++ b/cmd/podman/volumes/list.go @@ -62,6 +62,7 @@ func init() { flags.StringVar(&cliOpts.Format, formatFlagName, "{{.Driver}}\t{{.Name}}\n", "Format volume output using Go template") _ = lsCommand.RegisterFlagCompletionFunc(formatFlagName, common.AutocompleteJSONFormat) + flags.Bool("noheading", false, "Do not print headers") flags.BoolVarP(&cliOpts.Quiet, "quiet", "q", false, "Print volume output in quiet mode") } @@ -94,6 +95,7 @@ func list(cmd *cobra.Command, args []string) error { } func outputTemplate(cmd *cobra.Command, responses []*entities.VolumeListReport) error { + noHeading, _ := cmd.Flags().GetBool("noheading") headers := report.Headers(entities.VolumeListReport{}, map[string]string{ "Name": "VOLUME NAME", }) @@ -111,7 +113,7 @@ func outputTemplate(cmd *cobra.Command, responses []*entities.VolumeListReport) w := tabwriter.NewWriter(os.Stdout, 12, 2, 2, ' ', 0) defer w.Flush() - if !cliOpts.Quiet && !cmd.Flag("format").Changed { + if !(noHeading || cliOpts.Quiet || cmd.Flag("format").Changed) { if err := tmpl.Execute(w, headers); err != nil { return errors.Wrapf(err, "failed to write report column headers") } |