JMS #39: Removed all calls to os.Exit().

This commit is contained in:
Jeremy Saenz
2013-11-01 06:45:19 -07:00
parent e6e641143c
commit b25b7a883c
3 changed files with 26 additions and 15 deletions

19
help.go
View File

@@ -73,7 +73,6 @@ func ShowCommandHelp(c *Context, command string) {
}
fmt.Printf("No help topic for '%v'\n", command)
os.Exit(1)
}
// Prints the version number of the App
@@ -88,23 +87,29 @@ func printHelp(templ string, data interface{}) {
w.Flush()
}
func checkVersion(c *Context) {
func checkVersion(c *Context) bool {
if c.GlobalBool("version") {
ShowVersion(c)
os.Exit(0)
return true
}
return false
}
func checkHelp(c *Context) {
func checkHelp(c *Context) bool {
if c.GlobalBool("h") || c.GlobalBool("help") {
ShowAppHelp(c)
os.Exit(0)
return true
}
return false
}
func checkCommandHelp(c *Context, name string) {
func checkCommandHelp(c *Context, name string) bool {
if c.Bool("h") || c.Bool("help") {
ShowCommandHelp(c, name)
os.Exit(0)
return true
}
return false
}