1
0
mirror of https://github.com/beego/bee.git synced 2025-07-05 18:20:18 +00:00

return actual value from subcommand

This commit is contained in:
葛琦
2014-08-15 17:38:51 +08:00
parent 70886d4cfd
commit 55741df579
12 changed files with 24 additions and 14 deletions

5
bee.go
View File

@ -30,7 +30,7 @@ const version = "1.2.1"
type Command struct {
// Run runs the command.
// The args are the arguments after the command name.
Run func(cmd *Command, args []string)
Run func(cmd *Command, args []string) int
// UsageLine is the one-line usage message.
// The first word in the line is taken to be the command name.
@ -110,8 +110,7 @@ func main() {
cmd.Flag.Parse(args[1:])
args = cmd.Flag.Args()
}
cmd.Run(cmd, args)
os.Exit(2)
os.Exit(cmd.Run(cmd, args))
return
}
}