Created
November 20, 2015 14:20
-
-
Save mattfarina/994acd1e1e8dd20d662f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"errors" | |
"github.com/codegangsta/cli" | |
) | |
var e error | |
func main() { | |
app := cli.NewApp() | |
app.Name = "boom" | |
app.Usage = "make an explosive entrance" | |
app.Action = func(c *cli.Context) { | |
println("boom! I say!") | |
e = errors.New("I brokes it") | |
return | |
} | |
app.After = func(c *cli.Context) error { | |
return e | |
} | |
app.RunAndExitOnError() | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ go run main.go | |
boom! I say! | |
I brokes it | |
exit status 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment