summaryrefslogtreecommitdiff
path: root/cmd/podman/pods
diff options
context:
space:
mode:
authorJhon Honce <jhonce@redhat.com>2020-10-28 11:03:09 -0700
committerJhon Honce <jhonce@redhat.com>2020-10-29 10:14:08 -0700
commitd60a0ddcc1784b2dd807cc8e4d4f3deb0c074171 (patch)
treeb1ec22f25a3239f41f3e7e42159091d3d135aa20 /cmd/podman/pods
parente439aec4fa867cda0672079dac0fe394dfb3306c (diff)
downloadpodman-d60a0ddcc1784b2dd807cc8e4d4f3deb0c074171.tar.gz
podman-d60a0ddcc1784b2dd807cc8e4d4f3deb0c074171.tar.bz2
podman-d60a0ddcc1784b2dd807cc8e4d4f3deb0c074171.zip
Restore --format table header support
Signed-off-by: Jhon Honce <jhonce@redhat.com>
Diffstat (limited to 'cmd/podman/pods')
-rw-r--r--cmd/podman/pods/ps.go9
-rw-r--r--cmd/podman/pods/stats.go3
2 files changed, 8 insertions, 4 deletions
diff --git a/cmd/podman/pods/ps.go b/cmd/podman/pods/ps.go
index 688108c1a..40fc71780 100644
--- a/cmd/podman/pods/ps.go
+++ b/cmd/podman/pods/ps.go
@@ -11,6 +11,7 @@ import (
"time"
"github.com/containers/common/pkg/report"
+ "github.com/containers/podman/v2/cmd/podman/parse"
"github.com/containers/podman/v2/cmd/podman/registry"
"github.com/containers/podman/v2/cmd/podman/validate"
"github.com/containers/podman/v2/pkg/domain/entities"
@@ -113,20 +114,22 @@ func pods(cmd *cobra.Command, _ []string) error {
"Created": "CREATED",
"InfraID": "INFRA ID",
})
+ renderHeaders := true
row := podPsFormat()
if cmd.Flags().Changed("format") {
+ renderHeaders = parse.HasTable(psInput.Format)
row = report.NormalizeFormat(psInput.Format)
}
- row = "{{range . }}" + row + "{{end}}"
+ format := parse.EnforceRange(row)
- tmpl, err := template.New("listPods").Parse(row)
+ tmpl, err := template.New("listPods").Parse(format)
if err != nil {
return err
}
w := tabwriter.NewWriter(os.Stdout, 8, 2, 2, ' ', 0)
defer w.Flush()
- if !psInput.Quiet && !cmd.Flag("format").Changed {
+ if renderHeaders {
if err := tmpl.Execute(w, headers); err != nil {
return err
}
diff --git a/cmd/podman/pods/stats.go b/cmd/podman/pods/stats.go
index 338f13d3e..c5d1e7f07 100644
--- a/cmd/podman/pods/stats.go
+++ b/cmd/podman/pods/stats.go
@@ -10,6 +10,7 @@ import (
"github.com/buger/goterm"
"github.com/containers/common/pkg/report"
+ "github.com/containers/podman/v2/cmd/podman/parse"
"github.com/containers/podman/v2/cmd/podman/registry"
"github.com/containers/podman/v2/cmd/podman/validate"
"github.com/containers/podman/v2/pkg/domain/entities"
@@ -135,7 +136,7 @@ func printFormattedPodStatsLines(headerNames []map[string]string, row string, st
return nil
}
- row = "{{range .}}" + row + "{{end}}"
+ row = parse.EnforceRange(row)
tmpl, err := template.New("pod stats").Parse(row)
if err != nil {