Updated README.md with exit code sample
This commit is contained in:
parent
49c1229409
commit
b79f884410
22
README.md
22
README.md
@ -251,6 +251,28 @@ app.Commands = []cli.Command{
|
|||||||
...
|
...
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Exit code
|
||||||
|
|
||||||
|
It is your responsability to call `os.Exit` with the exit code returned by
|
||||||
|
`app.Run`
|
||||||
|
|
||||||
|
```go
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"os"
|
||||||
|
"github.com/codegangsta/cli"
|
||||||
|
)
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
exitCode, err := cli.NewApp().Run(os.Args)
|
||||||
|
if err != nil {
|
||||||
|
log.Println(err)
|
||||||
|
}
|
||||||
|
os.Exit(exitCode)
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
### Bash Completion
|
### Bash Completion
|
||||||
|
|
||||||
You can enable completion commands by setting the `EnableBashCompletion`
|
You can enable completion commands by setting the `EnableBashCompletion`
|
||||||
|
Loading…
Reference in New Issue
Block a user