Implement custom help command for kubectl

Own implemenation 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 search query in short descriptions of commands in case of mismatch
with commands names.

fixes #25234
This commit is contained in:
Andrey Kurilin
2016-06-08 18:12:54 +03:00
committed by Andrey Kurilin
parent 6159126740
commit 48d47b1027
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)