Merge pull request #309 from dedalusj/check-completion-order
Run check completion before error checking
This commit is contained in:
commit
b5232bb293
16
app.go
16
app.go
@ -126,6 +126,10 @@ func (a *App) Run(arguments []string) (err error) {
|
||||
}
|
||||
context := NewContext(a, set, nil)
|
||||
|
||||
if checkCompletions(context) {
|
||||
return nil
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
fmt.Fprintln(a.Writer, "Incorrect Usage.")
|
||||
fmt.Fprintln(a.Writer)
|
||||
@ -133,10 +137,6 @@ func (a *App) Run(arguments []string) (err error) {
|
||||
return err
|
||||
}
|
||||
|
||||
if checkCompletions(context) {
|
||||
return nil
|
||||
}
|
||||
|
||||
if !a.HideHelp && checkHelp(context) {
|
||||
ShowAppHelp(context)
|
||||
return nil
|
||||
@ -233,6 +233,10 @@ func (a *App) RunAsSubcommand(ctx *Context) (err error) {
|
||||
return nerr
|
||||
}
|
||||
|
||||
if checkCompletions(context) {
|
||||
return nil
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
fmt.Fprintln(a.Writer, "Incorrect Usage.")
|
||||
fmt.Fprintln(a.Writer)
|
||||
@ -240,10 +244,6 @@ func (a *App) RunAsSubcommand(ctx *Context) (err error) {
|
||||
return err
|
||||
}
|
||||
|
||||
if checkCompletions(context) {
|
||||
return nil
|
||||
}
|
||||
|
||||
if len(a.Commands) > 0 {
|
||||
if checkSubcommandHelp(context) {
|
||||
return nil
|
||||
|
Loading…
Reference in New Issue
Block a user