|
|
@ -34,7 +34,7 @@ func NewApp() *App {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Entry point to the cli app. Parses the arguments slice and routes to the proper flag/args combination
|
|
|
|
// Entry point to the cli app. Parses the arguments slice and routes to the proper flag/args combination
|
|
|
|
func (a *App) Run(arguments []string) {
|
|
|
|
func (a *App) Run(arguments []string) error {
|
|
|
|
// append help to commands
|
|
|
|
// append help to commands
|
|
|
|
if a.Command(helpCommand.Name) == nil {
|
|
|
|
if a.Command(helpCommand.Name) == nil {
|
|
|
|
a.Commands = append(a.Commands, helpCommand)
|
|
|
|
a.Commands = append(a.Commands, helpCommand)
|
|
|
@ -54,7 +54,7 @@ func (a *App) Run(arguments []string) {
|
|
|
|
fmt.Println("Incorrect Usage.\n")
|
|
|
|
fmt.Println("Incorrect Usage.\n")
|
|
|
|
ShowAppHelp(context)
|
|
|
|
ShowAppHelp(context)
|
|
|
|
fmt.Println("")
|
|
|
|
fmt.Println("")
|
|
|
|
os.Exit(1)
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
checkHelp(context)
|
|
|
|
checkHelp(context)
|
|
|
@ -66,12 +66,13 @@ func (a *App) Run(arguments []string) {
|
|
|
|
c := a.Command(name)
|
|
|
|
c := a.Command(name)
|
|
|
|
if c != nil {
|
|
|
|
if c != nil {
|
|
|
|
c.Run(context)
|
|
|
|
c.Run(context)
|
|
|
|
return
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Run default Action
|
|
|
|
// Run default Action
|
|
|
|
a.Action(context)
|
|
|
|
a.Action(context)
|
|
|
|
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Returns the named command on App. Returns nil if the command does not exist
|
|
|
|
// Returns the named command on App. Returns nil if the command does not exist
|
|
|
|