aboutsummaryrefslogtreecommitdiff
path: root/cmd/podman/version.go
diff options
context:
space:
mode:
authorbaude <bbaude@redhat.com>2018-03-26 09:39:14 -0500
committerAtomic Bot <atomic-devel@projectatomic.io>2018-04-23 14:29:45 +0000
commit8493dba23c73617d9529b7ca13b400d50ac6f455 (patch)
treec0de0c67334b9fa7166e01cae95dc560c1e2455a /cmd/podman/version.go
parentcf1d884ffa45b342f38a78189bbd86186ce6cbfe (diff)
downloadpodman-8493dba23c73617d9529b7ca13b400d50ac6f455.tar.gz
podman-8493dba23c73617d9529b7ca13b400d50ac6f455.tar.bz2
podman-8493dba23c73617d9529b7ca13b400d50ac6f455.zip
Initial varlink implementation
Signed-off-by: baude <bbaude@redhat.com> Closes: #627 Approved by: mheon
Diffstat (limited to 'cmd/podman/version.go')
-rw-r--r--cmd/podman/version.go39
1 files changed, 14 insertions, 25 deletions
diff --git a/cmd/podman/version.go b/cmd/podman/version.go
index be9b406e7..952cf32d3 100644
--- a/cmd/podman/version.go
+++ b/cmd/podman/version.go
@@ -2,41 +2,30 @@ package main
import (
"fmt"
- "runtime"
- "strconv"
"time"
+ "github.com/pkg/errors"
+ "github.com/projectatomic/libpod/libpod"
"github.com/urfave/cli"
)
-// Overwritten at build time
-var (
- // gitCommit is the commit that the binary is being built from.
- // It will be populated by the Makefile.
- gitCommit string
- // buildInfo is the time at which the binary was built
- // It will be populated by the Makefile.
- buildInfo string
-)
-
// versionCmd gets and prints version info for version command
func versionCmd(c *cli.Context) error {
- fmt.Println("Version: ", c.App.Version)
- fmt.Println("Go Version: ", runtime.Version())
- if gitCommit != "" {
- fmt.Println("Git Commit: ", gitCommit)
+ output, err := libpod.GetVersion()
+ if err != nil {
+ errors.Wrapf(err, "unable to determine version")
+ }
+ fmt.Println("Version: ", output.Version)
+ fmt.Println("Go Version: ", output.GoVersion)
+ if output.GitCommit != "" {
+ fmt.Println("Git Commit: ", output.GitCommit)
}
- if buildInfo != "" {
- // Converts unix time from string to int64
- buildTime, err := strconv.ParseInt(buildInfo, 10, 64)
- if err != nil {
- return err
- }
- // Prints out the build time in readable format
- fmt.Println("Built: ", time.Unix(buildTime, 0).Format(time.ANSIC))
+ // Prints out the build time in readable format
+ if libpod.BuildInfo != "" {
+ fmt.Println("Built: ", time.Unix(output.Built, 0).Format(time.ANSIC))
}
- fmt.Println("OS/Arch: ", runtime.GOOS+"/"+runtime.GOARCH)
+ fmt.Println("OS/Arch: ", output.OsArch)
return nil
}