-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(Conditionally Required): adds the ability for an arg to be condi…
…tionally required An arg can now be conditionally required (i.e. it's only required if arg A is used with a value of V). For example: ```rust let res = App::new("ri") .arg(Arg::with_name("cfg") .required_if("extra", "val") .takes_value(true) .long("config")) .arg(Arg::with_name("extra") .takes_value(true) .long("extra")) .get_matches_from_safe(vec![ "ri", "--extra", "val" ]); assert!(res.is_err()); assert_eq!(res.unwrap_err().kind, ErrorKind::MissingRequiredArgument); ``` Relates to #764
- Loading branch information
Showing
2 changed files
with
196 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters