|
|
@ -154,19 +154,20 @@ func (c Command) Run(ctx *Context) (err error) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
context := NewContext(ctx.App, set, ctx)
|
|
|
|
context := NewContext(ctx.App, set, ctx)
|
|
|
|
|
|
|
|
context.Command = c
|
|
|
|
if checkCommandCompletions(context, c.Name) {
|
|
|
|
if checkCommandCompletions(context, c.Name) {
|
|
|
|
return nil
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if err != nil {
|
|
|
|
if err != nil {
|
|
|
|
if c.OnUsageError != nil {
|
|
|
|
if c.OnUsageError != nil {
|
|
|
|
err := c.OnUsageError(ctx, err, false)
|
|
|
|
err := c.OnUsageError(context, err, false)
|
|
|
|
HandleExitCoder(err)
|
|
|
|
HandleExitCoder(err)
|
|
|
|
return err
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
}
|
|
|
|
fmt.Fprintln(ctx.App.Writer, "Incorrect Usage:", err.Error())
|
|
|
|
fmt.Fprintln(context.App.Writer, "Incorrect Usage:", err.Error())
|
|
|
|
fmt.Fprintln(ctx.App.Writer)
|
|
|
|
fmt.Fprintln(context.App.Writer)
|
|
|
|
ShowCommandHelp(ctx, c.Name)
|
|
|
|
ShowCommandHelp(context, c.Name)
|
|
|
|
return err
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -191,9 +192,9 @@ func (c Command) Run(ctx *Context) (err error) {
|
|
|
|
if c.Before != nil {
|
|
|
|
if c.Before != nil {
|
|
|
|
err = c.Before(context)
|
|
|
|
err = c.Before(context)
|
|
|
|
if err != nil {
|
|
|
|
if err != nil {
|
|
|
|
fmt.Fprintln(ctx.App.Writer, err)
|
|
|
|
fmt.Fprintln(context.App.Writer, err)
|
|
|
|
fmt.Fprintln(ctx.App.Writer)
|
|
|
|
fmt.Fprintln(context.App.Writer)
|
|
|
|
ShowCommandHelp(ctx, c.Name)
|
|
|
|
ShowCommandHelp(context, c.Name)
|
|
|
|
HandleExitCoder(err)
|
|
|
|
HandleExitCoder(err)
|
|
|
|
return err
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -203,7 +204,6 @@ func (c Command) Run(ctx *Context) (err error) {
|
|
|
|
c.Action = helpSubcommand.Action
|
|
|
|
c.Action = helpSubcommand.Action
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
context.Command = c
|
|
|
|
|
|
|
|
err = HandleAction(c.Action, context)
|
|
|
|
err = HandleAction(c.Action, context)
|
|
|
|
|
|
|
|
|
|
|
|
if err != nil {
|
|
|
|
if err != nil {
|
|
|
|