From 78d8cc516fa302594b4c79931f7acdbcb40211ac Mon Sep 17 00:00:00 2001 From: Arnav Borborah Date: Sun, 13 Jan 2019 17:24:22 +0000 Subject: [PATCH] Change exit code for help and version messages to 0 --- src/main.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/main.rs b/src/main.rs index 10d030e..031f6e3 100644 --- a/src/main.rs +++ b/src/main.rs @@ -272,6 +272,14 @@ fn main() { if let Err(err) = result { if let Some(clap_err) = err.downcast_ref::() { 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); }