Skip to content

Commit

Permalink
prevents root cmd from displaying help first
Browse files Browse the repository at this point in the history
help is now displayed after exec for the root command
  • Loading branch information
leucos committed Oct 13, 2022
1 parent 54b2028 commit ef4e602
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,13 +91,14 @@ selected.`,
return nil
},
Run: func(cmd *cobra.Command, args []string) {
if !strings.HasSuffix(os.Args[0], "binenv") {
a.Execute(os.Args)
return
}
if len(args) == 0 {
cmd.Help()
os.Exit(0)
}
if !strings.HasSuffix(os.Args[0], "binenv") {
a.Execute(os.Args)
}
},
}

Expand Down

0 comments on commit ef4e602

Please sign in to comment.