Added exit code support

Now the exit code can be returned by BeforeFn, ActionFn and AfterFn.

The `os.Exit` function is not called by this packaged

This closes #66 and closes #164
This commit is contained in:
Tarcísio Gruppi
2015-07-28 20:05:14 +02:00
parent 9c0db3f4ac
commit 49c1229409
4 changed files with 43 additions and 38 deletions

View File

@@ -72,13 +72,14 @@ var helpCommand = Command{
Name: "help",
Aliases: []string{"h"},
Usage: "Shows a list of commands or help for one command",
Action: func(c *Context) {
Action: func(c *Context) int {
args := c.Args()
if args.Present() {
ShowCommandHelp(c, args.First())
} else {
ShowAppHelp(c)
}
return 0
},
}
@@ -86,13 +87,14 @@ var helpSubcommand = Command{
Name: "help",
Aliases: []string{"h"},
Usage: "Shows a list of commands or help for one command",
Action: func(c *Context) {
Action: func(c *Context) int {
args := c.Args()
if args.Present() {
ShowCommandHelp(c, args.First())
} else {
ShowSubcommandHelp(c)
}
return 0
},
}