From a0a2a40fed57f7c5ad9d68970d090e9856306c7d Mon Sep 17 00:00:00 2001 From: Kevin K Date: Wed, 1 Apr 2015 20:16:45 -0400 Subject: [PATCH] fix(flags): add assertion to catch flags with specific value sets Closes #52 --- src/app.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/app.rs b/src/app.rs index b127bffb7e4..b31392ff4f7 100644 --- a/src/app.rs +++ b/src/app.rs @@ -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