diff options
Diffstat (limited to 'cmd/podman')
-rw-r--r-- | cmd/podman/system/version.go | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/cmd/podman/system/version.go b/cmd/podman/system/version.go index b7fa289a5..92a3225b6 100644 --- a/cmd/podman/system/version.go +++ b/cmd/podman/system/version.go @@ -7,6 +7,7 @@ import ( "strings" "text/tabwriter" + "github.com/containers/buildah/pkg/formats" "github.com/containers/libpod/cmd/podman/registry" "github.com/containers/libpod/cmd/podman/validate" "github.com/containers/libpod/libpod/define" @@ -51,6 +52,17 @@ func version(cmd *cobra.Command, args []string) error { if !strings.HasSuffix(versionFormat, "\n") { versionFormat += "\n" } + out := formats.StdoutTemplate{Output: versions, Template: versionFormat} + err := out.Out() + if err != nil { + // On Failure, assume user is using older version of podman version --format and check client + versionFormat = strings.Replace(versionFormat, ".Server.", ".", 1) + out = formats.StdoutTemplate{Output: versions.Client, Template: versionFormat} + if err1 := out.Out(); err1 != nil { + return err + } + } + return nil } w := tabwriter.NewWriter(os.Stdout, 0, 0, 2, ' ', 0) @@ -73,7 +85,7 @@ func version(cmd *cobra.Command, args []string) error { func formatVersion(writer io.Writer, version *define.Version) { fmt.Fprintf(writer, "Version:\t%s\n", version.Version) - fmt.Fprintf(writer, "RemoteAPI Version:\t%d\n", version.RemoteAPIVersion) + fmt.Fprintf(writer, "API Version:\t%d\n", version.APIVersion) fmt.Fprintf(writer, "Go Version:\t%s\n", version.GoVersion) if version.GitCommit != "" { fmt.Fprintf(writer, "Git Commit:\t%s\n", version.GitCommit) |