Skip to content

Commit

Permalink
Fix kubectl help command
Browse files Browse the repository at this point in the history
PR 48d47b1 broke `kubectl help` command due
to wrong check `help for help cmd` .

Fixed issue #29736
  • Loading branch information
andreykurilin committed Jul 28, 2016
1 parent 1d8c15b commit b2f8ee4
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions pkg/kubectl/cmd/help.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ func NewCmdHelp(f *cmdutil.Factory, out io.Writer) *cobra.Command {
}

func RunHelp(cmd *cobra.Command, args []string) {
foundCmd, a, err := cmd.Root().Find(args)
foundCmd, _, err := cmd.Root().Find(args)

// NOTE(andreykurilin): actually, I did not find any cases when foundCmd can be nil,
// but let's make this check since it is included in original code of initHelpCmd
Expand Down Expand Up @@ -69,10 +69,11 @@ func RunHelp(cmd *cobra.Command, args []string) {
// if nothing is found, just print usage
cmd.Root().Usage()
}
} else if len(a) == 0 {
// help message for help command :)
cmd.Root().Usage()
} else {
if len(args) == 0 {
// help message for help command :)
foundCmd = cmd
}
helpFunc := foundCmd.HelpFunc()
helpFunc(foundCmd, args)
}
Expand Down

0 comments on commit b2f8ee4

Please sign in to comment.