Skip to content

Commit

Permalink
fix #314: --version not showing lab version
Browse files Browse the repository at this point in the history
  • Loading branch information
zaquestion committed Oct 25, 2019
1 parent 45bb615 commit 04596ae
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,11 @@ var RootCmd = &cobra.Command{
ZshCompletionFunction: zshCompletionFunction,
Run: func(cmd *cobra.Command, args []string) {
if ok, err := cmd.Flags().GetBool("version"); err == nil && ok {
fmt.Println("here")
versionCmd.Run(cmd, args)
return
} else {
fmt.Println("here 2")
}
helpCmd.Run(cmd, args)
},
Expand Down Expand Up @@ -287,13 +290,13 @@ func Execute() {
// allow flags to the root cmd to be passed through. Technically we'll drop any exit code info which isn't ideal.
// TODO: remove for 1.0 when we stop wrapping git
if cmd.Use == RootCmd.Use && len(os.Args) > 1 {
var hFlaged bool
var knownFlag bool
for _, v := range os.Args {
if v == "--help" {
hFlaged = true
if v == "--help" || v == "--version" {
knownFlag = true
}
}
if !hFlaged {
if !knownFlag {
git.New(os.Args[1:]...).Run()
return
}
Expand Down

0 comments on commit 04596ae

Please sign in to comment.