Skip to content

Commit

Permalink
doc
Browse files Browse the repository at this point in the history
  • Loading branch information
cristaloleg committed Jan 22, 2022
1 parent 1ed3507 commit 4d5e886
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ r := acmd.RunnerOf(cmds, acmd.Config{
})

if err := r.Run(); err != nil {
panic(err)
r.Exit(err)
}
```

Expand Down
5 changes: 4 additions & 1 deletion acmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,10 @@ func RunnerOf(cmds []Command, cfg Config) *Runner {
return r
}

// Exit the application.
// Exit the application depending on the error.
// If err is nil, so successful/no error exit is done: os.Exit(0)
// If err is of type ErrCode: code from the error is returned: os.Exit(code)
// Otherwise: os.Exit(1).
func (r *Runner) Exit(err error) {
if err == nil {
os.Exit(0)
Expand Down

0 comments on commit 4d5e886

Please sign in to comment.