1 parent 1528908 commit f77a740Copy full SHA for f77a740
1 file changed
src/cli.rs
@@ -201,9 +201,12 @@ impl Command {
201
/// Get the value of an option in its location
202
pub fn get_option(&self, option_name: &str) -> Value {
203
let args: Vec<String> = env::args().collect();
204
-
205
for (index, option) in self.options.iter().enumerate() {
206
- if args.len() <= 2 + (index) {
+ if option.name != option_name {
+ continue;
207
+ }
208
+
209
+ if args.len() <= 2 + index {
210
return Value::Missing(format!(
211
"{} could not be found in its location ({})",
212
option_name,
@@ -219,6 +222,8 @@ impl Command {
219
222
option_name
220
223
));
221
224
}
225
226
+ return Value::Present(value);
227
228
229
0 commit comments