Merge pull request #29737 from andreykurilin/fix_kubectl_help_cmd

Automatic merge from submit-queue

Fix kubectl help command

PR 48d47b1027 broke `kubectl help` command due
to wrong check `help for help cmd` .

Fixes #29736
pull/6/head
k8s-merge-robot 2016-07-28 19:07:55 -07:00 committed by GitHub
commit 96996985a0
1 changed files with 5 additions and 4 deletions

View File

@ -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
@ -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)
}