diff options
Diffstat (limited to 'cli/main.rs')
-rw-r--r-- | cli/main.rs | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/cli/main.rs b/cli/main.rs index b845a4f49..c996425c7 100644 --- a/cli/main.rs +++ b/cli/main.rs @@ -1376,7 +1376,11 @@ fn unwrap_or_exit<T>(result: Result<T, AnyError>) -> T { match result { Ok(value) => value, Err(error) => { - eprintln!("{}: {:?}", colors::red_bold("error"), error); + eprintln!( + "{}: {}", + colors::red_bold("error"), + format!("{:?}", error).trim_start_matches("error: ") + ); std::process::exit(1); } } @@ -1404,11 +1408,10 @@ pub fn main() { let flags = match flags::flags_from_vec(args) { Ok(flags) => flags, Err(err @ clap::Error { .. }) - if err.kind == clap::ErrorKind::HelpDisplayed - || err.kind == clap::ErrorKind::VersionDisplayed => + if err.kind == clap::ErrorKind::DisplayHelp + || err.kind == clap::ErrorKind::DisplayVersion => { - err.write_to(&mut std::io::stdout()).unwrap(); - std::io::stdout().write_all(b"\n").unwrap(); + err.print().unwrap(); std::process::exit(0); } Err(err) => unwrap_or_exit(Err(AnyError::from(err))), |