forked from TrueCloudLab/rclone
vendor: update all dependencies
This commit is contained in:
parent
940df88eb2
commit
d64789528d
4309 changed files with 1327278 additions and 1001118 deletions
28
vendor/github.com/spf13/cobra/command.go
generated
vendored
28
vendor/github.com/spf13/cobra/command.go
generated
vendored
|
@ -147,6 +147,11 @@ type Command struct {
|
|||
commandsMaxNameLen int
|
||||
// commandsAreSorted defines, if command slice are sorted or not.
|
||||
commandsAreSorted bool
|
||||
// commandCalledAs is the name or alias value used to call this command.
|
||||
commandCalledAs struct {
|
||||
name string
|
||||
called bool
|
||||
}
|
||||
|
||||
// args is actual args parsed from flags.
|
||||
args []string
|
||||
|
@ -470,6 +475,9 @@ Loop:
|
|||
s := args[0]
|
||||
args = args[1:]
|
||||
switch {
|
||||
case s == "--":
|
||||
// "--" terminates the flags
|
||||
break Loop
|
||||
case strings.HasPrefix(s, "--") && !strings.Contains(s, "=") && !hasNoOptDefVal(s[2:], flags):
|
||||
// If '--flag arg' then
|
||||
// delete arg from args.
|
||||
|
@ -557,6 +565,7 @@ func (c *Command) findNext(next string) *Command {
|
|||
matches := make([]*Command, 0)
|
||||
for _, cmd := range c.commands {
|
||||
if cmd.Name() == next || cmd.HasAlias(next) {
|
||||
cmd.commandCalledAs.name = next
|
||||
return cmd
|
||||
}
|
||||
if EnablePrefixMatching && cmd.hasNameOrAliasPrefix(next) {
|
||||
|
@ -567,6 +576,7 @@ func (c *Command) findNext(next string) *Command {
|
|||
if len(matches) == 1 {
|
||||
return matches[0]
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
@ -828,6 +838,11 @@ func (c *Command) ExecuteC() (cmd *Command, err error) {
|
|||
return c, err
|
||||
}
|
||||
|
||||
cmd.commandCalledAs.called = true
|
||||
if cmd.commandCalledAs.name == "" {
|
||||
cmd.commandCalledAs.name = cmd.Name()
|
||||
}
|
||||
|
||||
err = cmd.execute(flags)
|
||||
if err != nil {
|
||||
// Always show help if requested, even if SilenceErrors is in
|
||||
|
@ -1135,14 +1150,25 @@ func (c *Command) HasAlias(s string) bool {
|
|||
return false
|
||||
}
|
||||
|
||||
// CalledAs returns the command name or alias that was used to invoke
|
||||
// this command or an empty string if the command has not been called.
|
||||
func (c *Command) CalledAs() string {
|
||||
if c.commandCalledAs.called {
|
||||
return c.commandCalledAs.name
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
// hasNameOrAliasPrefix returns true if the Name or any of aliases start
|
||||
// with prefix
|
||||
func (c *Command) hasNameOrAliasPrefix(prefix string) bool {
|
||||
if strings.HasPrefix(c.Name(), prefix) {
|
||||
c.commandCalledAs.name = c.Name()
|
||||
return true
|
||||
}
|
||||
for _, alias := range c.Aliases {
|
||||
if strings.HasPrefix(alias, prefix) {
|
||||
c.commandCalledAs.name = alias
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
@ -1245,7 +1271,7 @@ func (c *Command) HasParent() bool {
|
|||
return c.parent != nil
|
||||
}
|
||||
|
||||
// GlobalNormalizationFunc returns the global normalization function or nil if doesn't exists.
|
||||
// GlobalNormalizationFunc returns the global normalization function or nil if it doesn't exist.
|
||||
func (c *Command) GlobalNormalizationFunc() func(f *flag.FlagSet, name string) flag.NormalizedName {
|
||||
return c.globNormFunc
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue