Skip to content

Commit

Permalink
Improve error message for bare arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
lunacookies committed Oct 16, 2023
1 parent 1867e32 commit 8f2be7c
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions crates/pipes-rs/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,12 @@ fn parse_args(config: &mut Config) {
_ => {}
}

if !arg.starts_with('-') {
eprintln!("error: unexpected argument “{arg}” found");
eprintln!("see --help");
process::exit(1);
}

let (option, value) = arg.split_once('=').unwrap_or_else(|| match args_i.next() {
Some(value) => (arg, value),
None => required_value(arg),
Expand Down

0 comments on commit 8f2be7c

Please sign in to comment.