Cleanup code for EarlyExit during help triggers

This commit is contained in:
topjohnwu
2025-10-18 20:32:59 -07:00
committed by John Wu
parent c94bd49a89
commit 52d8910bdd
3 changed files with 10 additions and 21 deletions

View File

@@ -84,17 +84,16 @@ impl<T> EarlyExitExt<T> for Result<T, EarlyExit> {
fn on_early_exit<F: FnOnce()>(self, print_help_msg: F) -> T {
match self {
Ok(t) => t,
Err(EarlyExit { output, status }) => match status {
Ok(_) => {
Err(EarlyExit { output, is_help }) => {
if is_help {
print_help_msg();
exit(0)
}
Err(_) => {
} else {
eprintln!("{output}");
print_help_msg();
exit(1)
}
},
}
}
}
}