Merge pull request #27049 from andreykurilin/kubectl_help

Automatic merge from submit-queue

Implement custom help command for kubectl

```release-note
* kubectl help now provides "Did you mean this?" suggestions for typo/invalid command names.
```

Custom implementation of help command allows to print `Did you mean this?` with
suggestions, which is missed in embed help command from github.com/spf13/cobra

Also, it can be extended with different search features. At this patch, help
command searches query in short descriptions of commands in case of mismatch
with commands names.

fixes #25234
This commit is contained in:
k8s-merge-robot
2016-06-30 16:32:16 -07:00
committed by GitHub
2 changed files with 81 additions and 0 deletions

View File

@@ -198,6 +198,8 @@ Find more information at https://github.com/kubernetes/kubernetes.`,
f.BindFlags(cmds.PersistentFlags())
f.BindExternalFlags(cmds.PersistentFlags())
cmds.SetHelpCommand(NewCmdHelp(f, out))
// From this point and forward we get warnings on flags that contain "_" separators
cmds.SetGlobalNormalizationFunc(flag.WarnWordSepNormalizeFunc)