Skip to content

Commit

Permalink
Merge pull request #645 from dnephin/use-upstream-spf13-cobra
Browse files Browse the repository at this point in the history
Hide help flag from help output
  • Loading branch information
thaJeztah authored Oct 27, 2017
2 parents 50e1161 + f50345a commit 6aedafd
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion cli/cobra.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ func SetupRootCommand(rootCmd *cobra.Command) {

rootCmd.PersistentFlags().BoolP("help", "h", false, "Print usage")
rootCmd.PersistentFlags().MarkShorthandDeprecated("help", "please use --help")
rootCmd.PersistentFlags().Lookup("help").Hidden = true
}

// FlagErrorFunc prints an error message which matches the format of the
Expand Down Expand Up @@ -100,7 +101,7 @@ func managementSubCommands(cmd *cobra.Command) []*cobra.Command {

// UseLine returns the usage line for a command. This implementation is different
// from the default Command.UseLine in that it does not add a `[flags]` to the
// of the line.
// end of the line.
func UseLine(cmd *cobra.Command) string {
if cmd.HasParent() {
return cmd.Parent().CommandPath() + " " + cmd.Use
Expand Down

0 comments on commit 6aedafd

Please sign in to comment.