cli::command: wrap usage errors in a UsageError

So we can distinguish them and show usage output
conditionally.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
Wolfgang Bumiller committed 2019-01-03 16:08:51 +01:00
1 parent c7fa487250
commit 4968bc3ac0
2 files changed
+28 -14

No files matched your search

+3 -1
View File
@@ -146,7 +146,9 @@ fn main() {
if let Err(err) = run_cli_command(&cmd_def.into()) {
eprintln!("Error: {}", err);
print_cli_usage();
if err.downcast::<UsageError>().is_ok() {
print_cli_usage();
}
std::process::exit(-1);
}