Skip to content

Commit 772bfc1

Browse files
committed
fix(cli): do not display --version and --help as errors
Closes #331
1 parent 882ce73 commit 772bfc1

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

src/main.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,10 @@
33
use {
44
crate::{
55
disk::LiveDiskIo,
6+
errors::SyncpackError,
67
registry::client::{LiveRegistryClient, RegistryClient},
78
},
9+
clap::error::ErrorKind,
810
log::error,
911
std::{process::exit, sync::Arc},
1012
};
@@ -51,6 +53,12 @@ async fn main() {
5153
.await;
5254

5355
if let Err(e) = result {
56+
if let SyncpackError::CliError(clap_err) = &e {
57+
if matches!(clap_err.kind(), ErrorKind::DisplayHelp | ErrorKind::DisplayVersion) {
58+
println!("{clap_err}");
59+
return;
60+
}
61+
}
5462
let msg = e.to_string();
5563
if !msg.is_empty() {
5664
error!("{e}");

0 commit comments

Comments
 (0)