Skip to content

Commit

Permalink
fix(flags): add assertion to catch flags with specific value sets
Browse files Browse the repository at this point in the history
Closes #52
  • Loading branch information
kbknapp committed Apr 2, 2015
1 parent 82ad6ad commit a0a2a40
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,10 @@ impl<'a, 'v, 'ab, 'u, 'ar> App<'a, 'v, 'ab, 'u, 'ar>{
panic!("Argument \"{}\" must have either a short() and/or long() supplied since no index() or takes_value() were found", a.name);
}
if a.required {
panic!("Argument \"{}\" cannot be required(true) because it has no index() or takes_value(true)", a.name)
panic!("Argument \"{}\" cannot be required(true) because it has no index() or takes_value(true)", a.name);
}
if a.possible_vals.is_some() {
panic!("Argument \"{}\" cannot have a specific value set because it doesn't have takes_value(true) set", a.name);
}
// No need to check for index() or takes_value() as that is handled above

Expand Down

0 comments on commit a0a2a40

Please sign in to comment.