Added Before method to command. If set, or if command.Subcommands is set, then the command is treated as a recursive subcommand

This commit is contained in:
Summer Mousa
2014-04-16 15:26:28 -05:00
parent 1a63283d44
commit faf2a3d4a3
2 changed files with 15 additions and 4 deletions

7
app.go
View File

@@ -171,6 +171,13 @@ func (a *App) RunAsSubcommand(c *Context) error {
return nil
}
if a.Before != nil {
err := a.Before(context)
if err != nil {
return err
}
}
args := context.Args()
if args.Present() {
name := args.First()