mirror of
https://github.com/sharkdp/hexyl.git
synced 2026-10-27 21:28:18 +00:00
Fix #131
Don't print the error for version output, instead add a newline print. Move the eprint for help only.
This commit is contained in:
1 parent
642eff6061
commit
532eab762d
1 file changed
+9
-4
+9
-4
@@ -235,13 +235,18 @@ 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 => {
|
||||
clap::ErrorKind::HelpDisplayed => {
|
||||
eprint!("{}", clap_err); // Clap errors already have newlines
|
||||
std::process::exit(0)
|
||||
}
|
||||
},
|
||||
clap::ErrorKind::VersionDisplayed => {
|
||||
// Version output in clap 2.33.1 (dep as of now) doesn't have a newline
|
||||
// and the fix is not included even in the latest stable release
|
||||
println!("");
|
||||
std::process::exit(0)
|
||||
},
|
||||
_ => (),
|
||||
}
|
||||
} else {
|
||||
|
||||
Reference in new issue
Block a user