From 510d2f7a7656aba040816bf379eebbd4e4a6c4ed Mon Sep 17 00:00:00 2001 From: Benjamin Sago Date: Wed, 17 May 2017 21:01:12 +0100 Subject: [PATCH] --help and --version should have exit code 0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This makes it possible to use them in scripts. Also, I couldn’t find any other program returned a different error code! So it’s being changed to 0. Fixed #180. --- src/options/misfire.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/options/misfire.rs b/src/options/misfire.rs index 1ee437d..288d9b3 100644 --- a/src/options/misfire.rs +++ b/src/options/misfire.rs @@ -55,8 +55,11 @@ impl Misfire { /// The OS return code this misfire should signify. pub fn error_code(&self) -> i32 { - if let Misfire::Help(_) = *self { 2 } - else { 3 } + match *self { + Misfire::Help(_) => 0, + Misfire::Version => 0, + _ => 3, + } } /// The Misfire that happens when an option gets given the wrong