diff options
author | baude <bbaude@redhat.com> | 2019-03-18 09:37:01 -0500 |
---|---|---|
committer | baude <bbaude@redhat.com> | 2019-03-18 13:46:35 -0500 |
commit | 6aa8d14745dd778211fcf2941ce8fe5b5a95d5d9 (patch) | |
tree | 41cb96bdeb70ded51f28fcca2e90f07c49beff0c /cmd/podman/version.go | |
parent | ea54a1c2f51d3173649277939738ce9b1c392076 (diff) | |
download | podman-6aa8d14745dd778211fcf2941ce8fe5b5a95d5d9.tar.gz podman-6aa8d14745dd778211fcf2941ce8fe5b5a95d5d9.tar.bz2 podman-6aa8d14745dd778211fcf2941ce8fe5b5a95d5d9.zip |
support GO template {{ json . }}
for podman version, we now support a GO template for json output.
fixes #2671
Signed-off-by: baude <bbaude@redhat.com>
Diffstat (limited to 'cmd/podman/version.go')
-rw-r--r-- | cmd/podman/version.go | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/cmd/podman/version.go b/cmd/podman/version.go index 336be892e..31b0b8e82 100644 --- a/cmd/podman/version.go +++ b/cmd/podman/version.go @@ -3,6 +3,7 @@ package main import ( "fmt" "os" + "strings" "text/tabwriter" "time" @@ -43,6 +44,9 @@ func versionCmd(c *cliconfig.VersionValues) error { versionOutputFormat := c.Format if versionOutputFormat != "" { + if strings.Join(strings.Fields(versionOutputFormat), "") == "{{json.}}" { + versionOutputFormat = formats.JSONString + } var out formats.Writer switch versionOutputFormat { case formats.JSONString: |