Skip to content

Commit d4a6537

Browse files
committed
Don't die on invalid input
I previously had attempted to special case the help error, and died on the rest. Of course, this means when we're in the repl, we'd exit out, which is not intended behavior. Instead we now just print and return no matter what. FIxes #256
1 parent 3c1fb35 commit d4a6537

1 file changed

Lines changed: 5 additions & 8 deletions

File tree

src/main.rs

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ mod cmd_repl;
2121
fn main() -> Result<()> {
2222
let (commands, m, args) = match parse_args(&mut std::env::args_os()) {
2323
Some(s) => s,
24-
None => std::process::exit(0),
24+
None => std::process::exit(1),
2525
};
2626

2727
if let Some(s) = version(&args) {
@@ -83,13 +83,10 @@ where
8383

8484
let m = match command.try_get_matches_from(input.into_iter()) {
8585
Ok(m) => m,
86-
Err(e) => match e.kind() {
87-
clap::ErrorKind::DisplayHelp => {
88-
e.print().unwrap();
89-
return None;
90-
}
91-
_ => e.exit(),
92-
},
86+
Err(e) => {
87+
e.print().unwrap();
88+
return None;
89+
}
9390
};
9491

9592
let _args = Cli::from_arg_matches(&m);

0 commit comments

Comments
 (0)