diff --git a/cmd/version.go b/cmd/version.go index 09e6040..f968dd3 100644 --- a/cmd/version.go +++ b/cmd/version.go @@ -5,8 +5,8 @@ import ( "fmt" "os" "runtime" - "strings" + "github.com/cheynewallace/tabby" "github.com/mainawycliffe/kamanda/utils" "github.com/spf13/cobra" "gopkg.in/yaml.v2" @@ -34,9 +34,13 @@ var versionCmd = &cobra.Command{ "OS/Arch": fmt.Sprintf("%s/%s", runtime.GOOS, runtime.GOARCH), } if output == "text" { - for k, v := range kamandaVersion { - fmt.Printf("%s: \t %s \n", strings.Title(k), v) - } + t := tabby.New() + t.AddLine("Version:", version) + t.AddLine("Release Date:", date) + t.AddLine("Commit Hash:", commit) + t.AddLine("Built by:", builtBy) + t.AddLine("OS/Arch:", fmt.Sprintf("%s/%s", runtime.GOOS, runtime.GOARCH)) + t.Print() os.Exit(0) } if output == "json" { diff --git a/go.mod b/go.mod index 9d183b0..e5a3ccd 100644 --- a/go.mod +++ b/go.mod @@ -6,6 +6,7 @@ require ( cloud.google.com/go/firestore v1.2.0 // indirect firebase.google.com/go v3.12.0+incompatible github.com/bitfield/script v0.14.2 + github.com/cheynewallace/tabby v1.1.0 github.com/fsnotify/fsnotify v1.4.9 // indirect github.com/gdamore/tcell v1.3.0 github.com/go-chi/chi v4.0.4+incompatible diff --git a/go.sum b/go.sum index 0ab4beb..3488eab 100644 --- a/go.sum +++ b/go.sum @@ -58,6 +58,8 @@ github.com/bitfield/script v0.14.2 h1:5KEyazYK8/BHMrZyoIsHjJbckBBmXYrtgV1y4Cw9jU github.com/bitfield/script v0.14.2/go.mod h1:YGjrl5cZB++zV0DD8/tZmekyjaMDm4UMjatdA84FGj0= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= +github.com/cheynewallace/tabby v1.1.0 h1:XtG/ZanoIvNZHfe0cClhWLzD/16GGF9UD7mMdWwYnCQ= +github.com/cheynewallace/tabby v1.1.0/go.mod h1:Pba/6cUL8uYqvOc9RkyvFbHGrQ9wShyrn6/S/1OYVys= github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU=