Updating server dependancies (#6712)
Этот коммит содержится в:
коммит произвёл
Corey Hulen
родитель
6b39c308d8
Коммит
42f28ab8e3
65
vendor/github.com/spf13/cobra/command.go
сгенерированный
поставляемый
65
vendor/github.com/spf13/cobra/command.go
сгенерированный
поставляемый
@@ -678,7 +678,7 @@ func (c *Command) preRun() {
|
||||
}
|
||||
}
|
||||
|
||||
// Execute Call execute to use the args (os.Args[1:] by default)
|
||||
// Execute uses the args (os.Args[1:] by default)
|
||||
// and run through the command tree finding appropriate matches
|
||||
// for commands and then corresponding flags.
|
||||
func (c *Command) Execute() error {
|
||||
@@ -700,7 +700,7 @@ func (c *Command) ExecuteC() (cmd *Command, err error) {
|
||||
|
||||
// initialize help as the last point possible to allow for user
|
||||
// overriding
|
||||
c.initHelpCmd()
|
||||
c.InitDefaultHelpCmd()
|
||||
|
||||
var args []string
|
||||
|
||||
@@ -743,9 +743,8 @@ func (c *Command) ExecuteC() (cmd *Command, err error) {
|
||||
if !cmd.SilenceUsage && !c.SilenceUsage {
|
||||
c.Println(cmd.UsageString())
|
||||
}
|
||||
return cmd, err
|
||||
}
|
||||
return cmd, nil
|
||||
return cmd, err
|
||||
}
|
||||
|
||||
// InitDefaultHelpFlag adds default help flag to c.
|
||||
@@ -764,31 +763,32 @@ func (c *Command) InitDefaultHelpFlag() {
|
||||
}
|
||||
}
|
||||
|
||||
func (c *Command) initHelpCmd() {
|
||||
if c.helpCommand == nil {
|
||||
if !c.HasSubCommands() {
|
||||
return
|
||||
}
|
||||
// InitDefaultHelpCmd adds default help command to c.
|
||||
// It is called automatically by executing the c or by calling help and usage.
|
||||
// If c already has help command or c has no subcommands, it will do nothing.
|
||||
func (c *Command) InitDefaultHelpCmd() {
|
||||
if c.helpCommand != nil || !c.HasSubCommands() {
|
||||
return
|
||||
}
|
||||
|
||||
c.helpCommand = &Command{
|
||||
Use: "help [command]",
|
||||
Short: "Help about any command",
|
||||
Long: `Help provides help for any command in the application.
|
||||
c.helpCommand = &Command{
|
||||
Use: "help [command]",
|
||||
Short: "Help about any command",
|
||||
Long: `Help provides help for any command in the application.
|
||||
Simply type ` + c.Name() + ` help [path to command] for full details.`,
|
||||
PersistentPreRun: func(cmd *Command, args []string) {},
|
||||
PersistentPostRun: func(cmd *Command, args []string) {},
|
||||
PersistentPreRun: func(cmd *Command, args []string) {},
|
||||
PersistentPostRun: func(cmd *Command, args []string) {},
|
||||
|
||||
Run: func(c *Command, args []string) {
|
||||
cmd, _, e := c.Root().Find(args)
|
||||
if cmd == nil || e != nil {
|
||||
c.Printf("Unknown help topic %#q\n", args)
|
||||
c.Root().Usage()
|
||||
} else {
|
||||
cmd.InitDefaultHelpFlag() // make possible 'help' flag to be shown
|
||||
cmd.Help()
|
||||
}
|
||||
},
|
||||
}
|
||||
Run: func(c *Command, args []string) {
|
||||
cmd, _, e := c.Root().Find(args)
|
||||
if cmd == nil || e != nil {
|
||||
c.Printf("Unknown help topic %#q\n", args)
|
||||
c.Root().Usage()
|
||||
} else {
|
||||
cmd.InitDefaultHelpFlag() // make possible 'help' flag to be shown
|
||||
cmd.Help()
|
||||
}
|
||||
},
|
||||
}
|
||||
c.RemoveCommand(c.helpCommand)
|
||||
c.AddCommand(c.helpCommand)
|
||||
@@ -1249,13 +1249,20 @@ func (c *Command) persistentFlag(name string) (flag *flag.Flag) {
|
||||
}
|
||||
|
||||
// ParseFlags parses persistent flag tree and local flags.
|
||||
func (c *Command) ParseFlags(args []string) (err error) {
|
||||
func (c *Command) ParseFlags(args []string) error {
|
||||
if c.DisableFlagParsing {
|
||||
return nil
|
||||
}
|
||||
|
||||
beforeErrorBufLen := c.flagErrorBuf.Len()
|
||||
c.mergePersistentFlags()
|
||||
err = c.Flags().Parse(args)
|
||||
return
|
||||
err := c.Flags().Parse(args)
|
||||
// Print warnings if they occurred (e.g. deprecated flag messages).
|
||||
if c.flagErrorBuf.Len()-beforeErrorBufLen > 0 && err == nil {
|
||||
c.Print(c.flagErrorBuf.String())
|
||||
}
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
// Parent returns a commands parent command.
|
||||
|
||||
Ссылка в новой задаче
Block a user