summaryrefslogtreecommitdiff
path: root/cmd/podman/machine/list.go
diff options
context:
space:
mode:
Diffstat (limited to 'cmd/podman/machine/list.go')
-rw-r--r--cmd/podman/machine/list.go14
1 files changed, 9 insertions, 5 deletions
diff --git a/cmd/podman/machine/list.go b/cmd/podman/machine/list.go
index d569f4db0..774ab4fd0 100644
--- a/cmd/podman/machine/list.go
+++ b/cmd/podman/machine/list.go
@@ -116,7 +116,15 @@ func outputTemplate(cmd *cobra.Command, responses []*machineReporter) error {
"DiskSize": "DISK SIZE",
})
- row := report.NormalizeFormat(listFlag.format)
+ var row string
+ switch {
+ case cmd.Flags().Changed("format"):
+ row = cmd.Flag("format").Value.String()
+ listFlag.noHeading = !report.HasTable(row)
+ row = report.NormalizeFormat(row)
+ default:
+ row = cmd.Flag("format").Value.String()
+ }
format := report.EnforceRange(row)
tmpl, err := report.NewTemplate("list").Parse(format)
@@ -130,10 +138,6 @@ func outputTemplate(cmd *cobra.Command, responses []*machineReporter) error {
}
defer w.Flush()
- if cmd.Flags().Changed("format") && !report.HasTable(listFlag.format) {
- listFlag.noHeading = true
- }
-
if !listFlag.noHeading {
if err := tmpl.Execute(w, headers); err != nil {
return errors.Wrapf(err, "failed to write report column headers")