Run check completion before error checking
Running check completion before error checking allows for completion of flags when no character has been typed yet
This commit is contained in:
parent
7b94fd3aad
commit
4a8406ac89
16
app.go
16
app.go
@ -126,6 +126,10 @@ func (a *App) Run(arguments []string) (err error) {
|
|||||||
}
|
}
|
||||||
context := NewContext(a, set, nil)
|
context := NewContext(a, set, nil)
|
||||||
|
|
||||||
|
if checkCompletions(context) {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Fprintln(a.Writer, "Incorrect Usage.")
|
fmt.Fprintln(a.Writer, "Incorrect Usage.")
|
||||||
fmt.Fprintln(a.Writer)
|
fmt.Fprintln(a.Writer)
|
||||||
@ -133,10 +137,6 @@ func (a *App) Run(arguments []string) (err error) {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
if checkCompletions(context) {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
if !a.HideHelp && checkHelp(context) {
|
if !a.HideHelp && checkHelp(context) {
|
||||||
ShowAppHelp(context)
|
ShowAppHelp(context)
|
||||||
return nil
|
return nil
|
||||||
@ -233,6 +233,10 @@ func (a *App) RunAsSubcommand(ctx *Context) (err error) {
|
|||||||
return nerr
|
return nerr
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if checkCompletions(context) {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Fprintln(a.Writer, "Incorrect Usage.")
|
fmt.Fprintln(a.Writer, "Incorrect Usage.")
|
||||||
fmt.Fprintln(a.Writer)
|
fmt.Fprintln(a.Writer)
|
||||||
@ -240,10 +244,6 @@ func (a *App) RunAsSubcommand(ctx *Context) (err error) {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
if checkCompletions(context) {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
if len(a.Commands) > 0 {
|
if len(a.Commands) > 0 {
|
||||||
if checkSubcommandHelp(context) {
|
if checkSubcommandHelp(context) {
|
||||||
return nil
|
return nil
|
||||||
|
Loading…
Reference in New Issue
Block a user