• Home
  • Raw
  • Download

Lines Matching refs:Opt

25     struct Opt {  in required_option()  struct
30 Opt { arg: 42 }, in required_option()
31 Opt::try_parse_from(["test", "-a42"]).unwrap() in required_option()
34 Opt { arg: 42 }, in required_option()
35 Opt::try_parse_from(["test", "-a", "42"]).unwrap() in required_option()
38 Opt { arg: 42 }, in required_option()
39 Opt::try_parse_from(["test", "--arg", "42"]).unwrap() in required_option()
42 Opt { arg: 42 }, in required_option()
43 Opt::try_parse_from(["test", "--arg", "24", "--arg", "42"]).unwrap() in required_option()
45 assert!(Opt::try_parse_from(["test"]).is_err()); in required_option()
52 struct Opt { in option_with_default() struct
57 Opt { arg: 24 }, in option_with_default()
58 Opt::try_parse_from(["test", "-a24"]).unwrap() in option_with_default()
61 Opt { arg: 42 }, in option_with_default()
62 Opt::try_parse_from(["test", "-a", "24", "-a", "42"]).unwrap() in option_with_default()
64 assert_eq!(Opt { arg: 42 }, Opt::try_parse_from(["test"]).unwrap()); in option_with_default()
71 struct Opt { in option_with_raw_default() struct
76 Opt { arg: 24 }, in option_with_raw_default()
77 Opt::try_parse_from(["test", "-a24"]).unwrap() in option_with_raw_default()
80 Opt { arg: 42 }, in option_with_raw_default()
81 Opt::try_parse_from(["test", "-a", "24", "-a", "42"]).unwrap() in option_with_raw_default()
83 assert_eq!(Opt { arg: 42 }, Opt::try_parse_from(["test"]).unwrap()); in option_with_raw_default()
101 struct Opt { in option_from_str() struct
105 assert_eq!(Opt { a: None }, Opt::try_parse_from(["test"]).unwrap()); in option_from_str()
107 Opt { a: Some(A) }, in option_from_str()
108 Opt::try_parse_from(["test", "foo"]).unwrap() in option_from_str()
127 struct Opt { in vec_from_str() struct
132 Opt { a: Vec::new() }, in vec_from_str()
133 Opt::try_parse_from(["test"]).unwrap() in vec_from_str()
136 Opt { a: vec![A] }, in vec_from_str()
137 Opt::try_parse_from(["test", "foo"]).unwrap() in vec_from_str()
156 struct Opt { in option_vec_from_str() struct
161 assert_eq!(Opt { a: None }, Opt::try_parse_from(["test"]).unwrap()); in option_vec_from_str()
163 Opt { a: Some(vec![A]) }, in option_vec_from_str()
164 Opt::try_parse_from(["test", "-a", "foo"]).unwrap() in option_vec_from_str()
172 struct Opt { in option_type_is_optional() struct
177 Opt { arg: Some(42) }, in option_type_is_optional()
178 Opt::try_parse_from(["test", "-a42"]).unwrap() in option_type_is_optional()
181 Opt { arg: Some(42) }, in option_type_is_optional()
182 Opt::try_parse_from(["test", "-a", "24", "-a", "42"]).unwrap() in option_type_is_optional()
184 assert_eq!(Opt { arg: None }, Opt::try_parse_from(["test"]).unwrap()); in option_type_is_optional()
192 struct Opt { in required_with_option_type() struct
209 Opt { in required_with_option_type()
213 Opt::try_parse_from(["test", "arg"]).unwrap() in required_with_option_type()
217 Opt { in required_with_option_type()
221 Opt::try_parse_from(["test", "ex-sub", "-v"]).unwrap() in required_with_option_type()
224 assert!(Opt::try_parse_from(["test"]).is_err()); in required_with_option_type()
235 struct Opt { in ignore_qualified_option_type() struct
241 Opt { in ignore_qualified_option_type()
244 Opt::try_parse_from(["test", "success"]).unwrap() in ignore_qualified_option_type()
252 struct Opt { in option_option_type_is_optional_value() struct
258 Opt { in option_option_type_is_optional_value()
261 Opt::try_parse_from(["test", "-a42"]).unwrap() in option_option_type_is_optional_value()
264 Opt { arg: Some(None) }, in option_option_type_is_optional_value()
265 Opt::try_parse_from(["test", "-a"]).unwrap() in option_option_type_is_optional_value()
268 Opt { in option_option_type_is_optional_value()
271 Opt::try_parse_from(["test", "-a", "24", "-a", "42"]).unwrap() in option_option_type_is_optional_value()
273 assert_eq!(Opt { arg: None }, Opt::try_parse_from(["test"]).unwrap()); in option_option_type_is_optional_value()
280 struct Opt { in option_option_type_help() struct
284 let help = utils::get_help::<Opt>(); in option_option_type_help()
293 struct Opt { in two_option_option_types() struct
301 Opt { in two_option_option_types()
305 Opt::try_parse_from(["test", "-a42", "--field", "f"]).unwrap() in two_option_option_types()
308 Opt { in two_option_option_types()
312 Opt::try_parse_from(["test", "-a42", "--field"]).unwrap() in two_option_option_types()
315 Opt { in two_option_option_types()
319 Opt::try_parse_from(["test", "-a", "--field"]).unwrap() in two_option_option_types()
322 Opt { in two_option_option_types()
326 Opt::try_parse_from(["test", "-a", "--field", "f"]).unwrap() in two_option_option_types()
329 Opt { in two_option_option_types()
333 Opt::try_parse_from(["test", "--field"]).unwrap() in two_option_option_types()
336 Opt { in two_option_option_types()
340 Opt::try_parse_from(["test"]).unwrap() in two_option_option_types()
348 struct Opt { in vec_type_is_multiple_occurrences() struct
353 Opt { arg: vec![24] }, in vec_type_is_multiple_occurrences()
354 Opt::try_parse_from(["test", "-a24"]).unwrap() in vec_type_is_multiple_occurrences()
356 assert_eq!(Opt { arg: vec![] }, Opt::try_parse_from(["test"]).unwrap()); in vec_type_is_multiple_occurrences()
358 Opt { arg: vec![24, 42] }, in vec_type_is_multiple_occurrences()
359 Opt::try_parse_from(["test", "-a", "24", "-a", "42"]).unwrap() in vec_type_is_multiple_occurrences()
367 struct Opt { in vec_type_with_required() struct
372 Opt { arg: vec![24] }, in vec_type_with_required()
373 Opt::try_parse_from(["test", "-a24"]).unwrap() in vec_type_with_required()
375 assert!(Opt::try_parse_from(["test"]).is_err()); in vec_type_with_required()
377 Opt { arg: vec![24, 42] }, in vec_type_with_required()
378 Opt::try_parse_from(["test", "-a", "24", "-a", "42"]).unwrap() in vec_type_with_required()
386 struct Opt { in vec_type_with_multiple_values_only() struct
391 Opt { arg: vec![24] }, in vec_type_with_multiple_values_only()
392 Opt::try_parse_from(["test", "-a24"]).unwrap() in vec_type_with_multiple_values_only()
394 assert_eq!(Opt { arg: vec![] }, Opt::try_parse_from(["test"]).unwrap()); in vec_type_with_multiple_values_only()
396 Opt { arg: vec![24, 42] }, in vec_type_with_multiple_values_only()
397 Opt::try_parse_from(["test", "-a", "24", "42"]).unwrap() in vec_type_with_multiple_values_only()
409 struct Opt { in ignore_qualified_vec_type() struct
415 Opt { in ignore_qualified_vec_type()
418 Opt::try_parse_from(["test", "success"]).unwrap() in ignore_qualified_vec_type()
426 struct Opt { in option_vec_type() struct
431 Opt { arg: Some(vec![1]) }, in option_vec_type()
432 Opt::try_parse_from(["test", "-a", "1"]).unwrap() in option_vec_type()
436 Opt { in option_vec_type()
439 Opt::try_parse_from(["test", "-a", "1", "-a", "2"]).unwrap() in option_vec_type()
442 assert_eq!(Opt { arg: None }, Opt::try_parse_from(["test"]).unwrap()); in option_vec_type()
449 struct Opt { in option_vec_type_structopt_behavior() struct
454 Opt { arg: Some(vec![1]) }, in option_vec_type_structopt_behavior()
455 Opt::try_parse_from(["test", "-a", "1"]).unwrap() in option_vec_type_structopt_behavior()
459 Opt { in option_vec_type_structopt_behavior()
462 Opt::try_parse_from(["test", "-a", "1", "2"]).unwrap() in option_vec_type_structopt_behavior()
466 Opt { arg: Some(vec![]) }, in option_vec_type_structopt_behavior()
467 Opt::try_parse_from(["test", "-a"]).unwrap() in option_vec_type_structopt_behavior()
470 assert_eq!(Opt { arg: None }, Opt::try_parse_from(["test"]).unwrap()); in option_vec_type_structopt_behavior()
477 struct Opt { in two_option_vec_types() struct
486 Opt { in two_option_vec_types()
490 Opt::try_parse_from(["test", "-a", "1"]).unwrap() in two_option_vec_types()
494 Opt { in two_option_vec_types()
498 Opt::try_parse_from(["test", "-a", "1", "-b", "1"]).unwrap() in two_option_vec_types()
502 Opt { in two_option_vec_types()
506 Opt::try_parse_from(["test", "-a", "1", "-a", "2", "-b", "1", "-b", "2"]).unwrap() in two_option_vec_types()
510 Opt { arg: None, b: None }, in two_option_vec_types()
511 Opt::try_parse_from(["test"]).unwrap() in two_option_vec_types()
519 struct Opt { in explicit_value_parser() struct
524 Opt { arg: 42 }, in explicit_value_parser()
525 Opt::try_parse_from(["test", "--arg", "42"]).unwrap() in explicit_value_parser()
533 struct Opt { in implicit_value_parser() struct
538 Opt { arg: 42 }, in implicit_value_parser()
539 Opt::try_parse_from(["test", "--arg", "42"]).unwrap() in implicit_value_parser()