mirror of
https://github.com/sharkdp/hexyl.git
synced 2026-10-26 20:16:31 +00:00
Change exit code for help and version messages to 0
This commit is contained in:
1 parent
faebee7b8c
commit
78d8cc516f
1 file changed
+8
@@ -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);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user