Skip to content

Commit

Permalink
Fix optflagopt issue rust-lang#104.
Browse files Browse the repository at this point in the history
When the optflagopt long version is used the parser is ignoring the argument.
  • Loading branch information
pecastro committed Mar 28, 2021
1 parent c11eb65 commit 0cd41c7
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/lib.rs
Expand Up @@ -532,7 +532,14 @@ impl Options {
} else if was_long
|| args.peek().map_or(true, |n| is_arg(&n))
{
vals[opt_id].push((arg_pos, Given));
match args.peek() {
Some(_) => {
vals[opt_id].push((arg_pos, Val(args.next().unwrap())));
}
None => {
vals[opt_id].push((arg_pos, Given));
}
}
} else {
vals[opt_id].push((arg_pos, Val(args.next().unwrap())));
}
Expand Down

0 comments on commit 0cd41c7

Please sign in to comment.