From 5bc62ceeec6662ff8b7f7c403216846ce47bdbdf Mon Sep 17 00:00:00 2001 From: Daniel Nephin Date: Thu, 26 Oct 2017 11:51:12 -0400 Subject: [PATCH] Disable flags in UseLine Signed-off-by: Daniel Nephin --- command.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/command.go b/command.go index 58e6ceb0..126e6a05 100644 --- a/command.go +++ b/command.go @@ -118,6 +118,10 @@ type Command struct { // will be printed by generating docs for this command. DisableAutoGenTag bool + // DisableFlagsInUseLine will disable the addition of [flags] to the usage + // line of a command when printing help or generating docs + DisableFlagsInUseLine bool + // DisableSuggestions disables the suggestions based on Levenshtein distance // that go along with 'unknown command' messages. DisableSuggestions bool @@ -996,6 +1000,9 @@ func (c *Command) UseLine() string { } else { useline = c.Use } + if c.DisableFlagsInUseLine { + return useline + } if c.HasAvailableFlags() && !strings.Contains(useline, "[flags]") { useline += " [flags]" }