Skip to content

Commit

Permalink
error when the input is empty
Browse files Browse the repository at this point in the history
  • Loading branch information
SkwalExe committed Mar 21, 2022
1 parent e7d6ce3 commit eb183ce
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,16 @@ fn main() {
"--" => {
args.remove(0);
input = args.join(" ").to_string(); // everything after the "--" is the input and isn't parsed

if input.is_empty() {
// error if the input is empty
eprintln!(
"{}Error : the input is empty\nPlease specify the input after the '--'{}",
RED, RESET
);
process::exit(1);
}

break; // stop parsing arguments
}

Expand Down

0 comments on commit eb183ce

Please sign in to comment.