Skip to content
This repository has been archived by the owner on May 16, 2021. It is now read-only.

Commit

Permalink
Format Output of the Version
Browse files Browse the repository at this point in the history
  • Loading branch information
mainawycliffe committed Apr 12, 2020
1 parent 24af8d3 commit 0e41b32
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
12 changes: 8 additions & 4 deletions cmd/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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" {
Expand Down
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -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=
Expand Down

0 comments on commit 0e41b32

Please sign in to comment.