Skip to content

Commit

Permalink
Fix exit code if a valid cmd is passed (#91)
Browse files Browse the repository at this point in the history
  • Loading branch information
yashLadha authored and rakyll committed Mar 27, 2019
1 parent 954ead6 commit 036f72c
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -231,11 +231,15 @@ func shortenVersion(v string) string {
}

func usage(msg string) {
// default exit code for the statement
exitCode := 0
if msg != "" {
// founded an unexpected command
fmt.Printf("gops: %v\n", msg)
exitCode = 1
}
fmt.Fprintf(os.Stderr, "%v\n", helpText)
os.Exit(1)
os.Exit(exitCode)
}

func pad(s string, total int) string {
Expand Down

0 comments on commit 036f72c

Please sign in to comment.