Revert "Fixes group conflicting if two args with default values"

This reverts commit 01869744c2.
This commit is contained in:
Pavan Kumar Sunkara 2021-11-03 18:24:50 +00:00
parent bd8c36cf04
commit 4e370bb093
2 changed files with 1 additions and 24 deletions

View file

@ -278,7 +278,7 @@ impl<'help, 'app, 'parser> Validator<'help, 'app, 'parser> {
.app
.unroll_args_in_group(&g.id)
.iter()
.filter(|&a| matcher.contains(a) && !matcher.is_default_value(a))
.filter(|&a| matcher.contains(a))
.count()
> 1
};

View file

@ -294,29 +294,6 @@ fn group_in_conflicts_with() {
assert!(m.is_present("flag"));
}
#[test]
fn group_conflicts_with_default_value() {
let result = App::new("conflict")
.arg(
Arg::new("opt")
.long("opt")
.default_value("default")
.group("one"),
)
.arg(Arg::new("flag").long("flag").group("one"))
.try_get_matches_from(vec!["myprog", "--flag"]);
assert!(
result.is_ok(),
"arg group count should ignore default_value: {:?}",
result.unwrap_err()
);
let m = result.unwrap();
assert_eq!(m.value_of("opt"), Some("default"));
assert!(m.is_present("flag"));
}
#[test]
fn group_conflicts_with_default_arg() {
let result = App::new("conflict")