From f50345a26cf9480abd0ed16123a30de37c58bc79 Mon Sep 17 00:00:00 2001 From: Daniel Nephin Date: Thu, 26 Oct 2017 12:17:35 -0400 Subject: [PATCH] Hide help flag from help output. Signed-off-by: Daniel Nephin --- cli/cobra.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cli/cobra.go b/cli/cobra.go index ede5b3a11d..3a5691a8c3 100644 --- a/cli/cobra.go +++ b/cli/cobra.go @@ -26,6 +26,7 @@ func SetupRootCommand(rootCmd *cobra.Command) { rootCmd.PersistentFlags().BoolP("help", "h", false, "Print usage") rootCmd.PersistentFlags().MarkShorthandDeprecated("help", "please use --help") + rootCmd.PersistentFlags().Lookup("help").Hidden = true } // FlagErrorFunc prints an error message which matches the format of the @@ -100,7 +101,7 @@ func managementSubCommands(cmd *cobra.Command) []*cobra.Command { // UseLine returns the usage line for a command. This implementation is different // from the default Command.UseLine in that it does not add a `[flags]` to the -// of the line. +// end of the line. func UseLine(cmd *cobra.Command) string { if cmd.HasParent() { return cmd.Parent().CommandPath() + " " + cmd.Use