Skip to content

Commit

Permalink
imp: Add exitcode::USAGE exit code as suggested in clap-rs#1327
Browse files Browse the repository at this point in the history
The reason to do this is described well in issue clap-rs#1327. It is also a
recommendation of the Rust book itself:
https://rust-cli.github.io/book/in-depth/exit-code.html
  • Loading branch information
danielthegray committed Jan 17, 2020
1 parent f3683a9 commit a1445b0
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ maintenance = {status = "actively-developed"}

[dependencies]
bitflags = "1.2"
exitcode = "1.1.2"
unicode-width = "0.1.4"
textwrap = "0.11"
indexmap = "1.0.1"
Expand Down
4 changes: 2 additions & 2 deletions src/build/app/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1193,7 +1193,7 @@ impl<'b> App<'b> {
i.lock().read_line(&mut s).unwrap();
}
drop(e);
process::exit(1);
process::exit(exitcode::USAGE);
}

e.exit()
Expand Down Expand Up @@ -1268,7 +1268,7 @@ impl<'b> App<'b> {
}
drop(self);
drop(e);
process::exit(1);
process::exit(exitcode::USAGE);
}

drop(self);
Expand Down

0 comments on commit a1445b0

Please sign in to comment.