Skip to content

Commit

Permalink
fix(cli): version output for cli
Browse files Browse the repository at this point in the history
  • Loading branch information
William Fleming authored May 2, 2020
1 parent 89d1f41 commit 2a987cf
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
9 changes: 5 additions & 4 deletions command/tectl/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,25 +8,26 @@ import (
)

var (
Version string
VERSION string
RootCmd = &cobra.Command{
Use: "tectl",
Short: "tectl is a cli tool for managing thousandeyes",
Long: "tectl is a cli tool for managing thousandeyes and querying the existing configuration",
Run: func(cmd *cobra.Command, args []string) {
fmt.Printf("tectl version: %s", Version)
fmt.Printf("tectl version: %s", VERSION)
},
}
versionCmd = &cobra.Command{
Use: "version",
Short: "Print the version number of tectl",
Run: func(cmd *cobra.Command, args []string) {
fmt.Printf("version: %s", Version)
fmt.Printf("version: %s", VERSION)
},
}
)

func Execute() error {
func Execute(version string) error {
VERSION = version
return RootCmd.Execute()
}

Expand Down
6 changes: 5 additions & 1 deletion command/tectl/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ import (
"github.com/william20111/go-thousandeyes/command/tectl/cmd"
)

var (
Version string
)

func main() {
cmd.Execute()
cmd.Execute(Version)
}

0 comments on commit 2a987cf

Please sign in to comment.