Update cobra to 75205f23b3ea70dc7ae5e900d074e010c23c37e9
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
This commit is contained in:
parent
07a7c0632f
commit
ca01e57d55
2 changed files with 16 additions and 6 deletions
|
@ -139,7 +139,7 @@ clone git github.com/docker/docker-credential-helpers v0.3.0
|
|||
clone git github.com/docker/containerd 57b7c3da915ebe943bd304c00890959b191e5264
|
||||
|
||||
# cli
|
||||
clone git github.com/spf13/cobra acf60156558542e78c6f3695f74b0f871614ff55 https://github.com/dnephin/cobra.git
|
||||
clone git github.com/spf13/cobra 75205f23b3ea70dc7ae5e900d074e010c23c37e9 https://github.com/dnephin/cobra.git
|
||||
clone git github.com/spf13/pflag cb88ea77998c3f024757528e3305022ab50b43be
|
||||
clone git github.com/inconshreveable/mousetrap 76626ae9c91c4f2a10f34cad8ce83ea42c93bb75
|
||||
|
||||
|
|
20
vendor/src/github.com/spf13/cobra/command.go
vendored
20
vendor/src/github.com/spf13/cobra/command.go
vendored
|
@ -123,6 +123,9 @@ type Command struct {
|
|||
DisableSuggestions bool
|
||||
// If displaying suggestions, allows to set the minimum levenshtein distance to display, must be > 0
|
||||
SuggestionsMinimumDistance int
|
||||
|
||||
// Disable the flag parsing. If this is true all flags will be passed to the command as arguments.
|
||||
DisableFlagParsing bool
|
||||
}
|
||||
|
||||
// os.Args[1:] by default, if desired, can be overridden
|
||||
|
@ -556,12 +559,16 @@ func (c *Command) execute(a []string) (err error) {
|
|||
return flag.ErrHelp
|
||||
}
|
||||
|
||||
if err := c.ValidateArgs(a); err != nil {
|
||||
return err
|
||||
c.preRun()
|
||||
|
||||
argWoFlags := c.Flags().Args()
|
||||
if c.DisableFlagParsing {
|
||||
argWoFlags = a
|
||||
}
|
||||
|
||||
c.preRun()
|
||||
argWoFlags := c.Flags().Args()
|
||||
if err := c.ValidateArgs(argWoFlags); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
for p := c; p != nil; p = p.Parent() {
|
||||
if p.PersistentPreRunE != nil {
|
||||
|
@ -702,7 +709,7 @@ func (c *Command) ValidateArgs(args []string) error {
|
|||
if c.Args == nil {
|
||||
return nil
|
||||
}
|
||||
return c.Args(c, stripFlags(args, c))
|
||||
return c.Args(c, args)
|
||||
}
|
||||
|
||||
func (c *Command) initHelpFlag() {
|
||||
|
@ -1200,6 +1207,9 @@ func (c *Command) persistentFlag(name string) (flag *flag.Flag) {
|
|||
|
||||
// ParseFlags parses persistent flag tree & local flags
|
||||
func (c *Command) ParseFlags(args []string) (err error) {
|
||||
if c.DisableFlagParsing {
|
||||
return nil
|
||||
}
|
||||
c.mergePersistentFlags()
|
||||
err = c.Flags().Parse(args)
|
||||
return
|
||||
|
|
Loading…
Reference in a new issue