summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/spf13/cobra/command.go
diff options
context:
space:
mode:
authorChristopher Speller <crspeller@gmail.com>2018-05-18 07:32:31 -0700
committerGitHub <noreply@github.com>2018-05-18 07:32:31 -0700
commitd5e1f7e2982c2fcc888ccac550b34095efbee217 (patch)
treed8cfe7e3f47537cce92b26a1b32b9081f0bd7993 /vendor/github.com/spf13/cobra/command.go
parentd3ead7dc8535f8fa5b175686cc1f7669c8b1648b (diff)
downloadchat-d5e1f7e2982c2fcc888ccac550b34095efbee217.tar.gz
chat-d5e1f7e2982c2fcc888ccac550b34095efbee217.tar.bz2
chat-d5e1f7e2982c2fcc888ccac550b34095efbee217.zip
Upgrading server dependency. (#8807)
Diffstat (limited to 'vendor/github.com/spf13/cobra/command.go')
-rw-r--r--vendor/github.com/spf13/cobra/command.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/vendor/github.com/spf13/cobra/command.go b/vendor/github.com/spf13/cobra/command.go
index 15b811279..34d1bf367 100644
--- a/vendor/github.com/spf13/cobra/command.go
+++ b/vendor/github.com/spf13/cobra/command.go
@@ -27,6 +27,9 @@ import (
flag "github.com/spf13/pflag"
)
+// FParseErrWhitelist configures Flag parse errors to be ignored
+type FParseErrWhitelist flag.ParseErrorsWhitelist
+
// Command is just that, a command for your application.
// E.g. 'go run ...' - 'run' is the command. Cobra requires
// you to define the usage and description as part of your command
@@ -137,6 +140,9 @@ type Command struct {
// TraverseChildren parses flags on all parents before executing child command.
TraverseChildren bool
+ //FParseErrWhitelist flag parse errors to be ignored
+ FParseErrWhitelist FParseErrWhitelist
+
// commands is the list of commands supported by this program.
commands []*Command
// parent is a parent command for this command.
@@ -1463,6 +1469,10 @@ func (c *Command) ParseFlags(args []string) error {
}
beforeErrorBufLen := c.flagErrorBuf.Len()
c.mergePersistentFlags()
+
+ //do it here after merging all flags and just before parse
+ c.Flags().ParseErrorsWhitelist = flag.ParseErrorsWhitelist(c.FParseErrWhitelist)
+
err := c.Flags().Parse(args)
// Print warnings if they occurred (e.g. deprecated flag messages).
if c.flagErrorBuf.Len()-beforeErrorBufLen > 0 && err == nil {