summaryrefslogtreecommitdiff
path: root/cmd/podman/system/info.go
diff options
context:
space:
mode:
authorJhon Honce <jhonce@redhat.com>2021-12-02 11:05:03 -0700
committerJhon Honce <jhonce@redhat.com>2021-12-03 13:48:58 -0700
commit7d22cc88ef382033c59d09570d1525189e104eae (patch)
tree19c00abc3c22f7ae1a49e1a616864426fed5fe0a /cmd/podman/system/info.go
parenta50502dd3d8ef5c80d686824ba2023927825fd2c (diff)
downloadpodman-7d22cc88ef382033c59d09570d1525189e104eae.tar.gz
podman-7d22cc88ef382033c59d09570d1525189e104eae.tar.bz2
podman-7d22cc88ef382033c59d09570d1525189e104eae.zip
Refactor podman system to report.Formatter
[NO NEW TESTS NEEDED] Support better compatibility output for podman system commands * Format and content of output from podman version changed to be more compatible See #10974 Depends on containers/common#831 Signed-off-by: Jhon Honce <jhonce@redhat.com>
Diffstat (limited to 'cmd/podman/system/info.go')
-rw-r--r--cmd/podman/system/info.go6
1 files changed, 5 insertions, 1 deletions
diff --git a/cmd/podman/system/info.go b/cmd/podman/system/info.go
index c3f543e6a..c323ee276 100644
--- a/cmd/podman/system/info.go
+++ b/cmd/podman/system/info.go
@@ -3,6 +3,7 @@ package system
import (
"fmt"
"os"
+ "text/template"
"github.com/containers/common/pkg/completion"
"github.com/containers/common/pkg/report"
@@ -84,7 +85,10 @@ func info(cmd *cobra.Command, args []string) error {
}
fmt.Println(string(b))
case cmd.Flags().Changed("format"):
- tmpl, err := report.NewTemplate("info").Parse(inFormat)
+ // Cannot use report.New() as it enforces {{range .}} for OriginUser templates
+ tmpl := template.New(cmd.Name()).Funcs(template.FuncMap(report.DefaultFuncs))
+ inFormat = report.NormalizeFormat(inFormat)
+ tmpl, err := tmpl.Parse(inFormat)
if err != nil {
return err
}