Change exit code for help and version messages to 0

This commit is contained in:
Arnav Borborah authored and David Peter committed 2019-01-13 18:35:15 +01:00
1 parent faebee7b8c
commit 78d8cc516f
1 file changed
+8
+8
View File
@@ -272,6 +272,14 @@ fn main() {
if let Err(err) = result {
if let Some(clap_err) = err.downcast_ref::<clap::Error>() {
eprint!("{}", clap_err); // Clap errors already have newlines
match clap_err.kind {
// The exit code should not indicate an error for --help / --version
clap::ErrorKind::HelpDisplayed | clap::ErrorKind::VersionDisplayed => {
std::process::exit(0)
}
_ => (),
}
} else {
eprintln!("Error: {}", err);
}