Skip to content

Commit

Permalink
--help and --version should have exit code 0
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
ogham committed May 17, 2017
1 parent e10c4b3 commit 510d2f7
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/options/misfire.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 510d2f7

Please sign in to comment.