mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 19:56:01 +00:00
Fix kubectl help command
PR 48d47b1027
broke `kubectl help` command due
to wrong check `help for help cmd` .
Fixed issue #29736
This commit is contained in:
parent
1d8c15ba14
commit
b2f8ee4f12
@ -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)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user