Skip to content

Commit

Permalink
Exit with code 2 when an invalid command is provided
Browse files Browse the repository at this point in the history
  • Loading branch information
gilbertchen committed Jan 4, 2021
1 parent 41a8f65 commit 4104c2f
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions duplicacy/duplicacy_main.go
Original file line number Diff line number Diff line change
Expand Up @@ -2188,6 +2188,12 @@ func main() {
app.Usage = "A new generation cloud backup tool based on lock-free deduplication"
app.Version = "2.7.2" + " (" + GitCommit + ")"

// Exit with code 2 if an invalid command is provided
app.CommandNotFound = func(context *cli.Context, command string) {
fmt.Fprintf(context.App.Writer, "Invalid command: %s\n", command)
os.Exit(2)
}

// If the program is interrupted, call the RunAtError function.
c := make(chan os.Signal, 1)
signal.Notify(c, os.Interrupt)
Expand Down

0 comments on commit 4104c2f

Please sign in to comment.