diff options
author | Leo Kettmeir <crowlkats@toaxl.com> | 2022-01-14 17:38:17 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-14 17:38:17 +0100 |
commit | e650165e80294fc66d88b0ff5451b5617bb8bff9 (patch) | |
tree | 3891947fb56ae1bbd05642a3e5d5e181a8284d5f /cli/main.rs | |
parent | 659bbd731cedbabe426c76e33cefcc68ee7d1e63 (diff) |
chore: upgrade clap to v3 (#13266)
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))), |