Exclusive can not be used with required #3595
Labels
A-validators
Area: ArgMatches validation logi
C-bug
Category: Updating dependencies
E-medium
Call for participation: Experience needed to fix: Medium / intermediate
Milestone
Please complete the following tasks
Rust Version
rustc 1.58.1 (db9d1b20b 2022-01-20)
Clap Version
3.1.6
Minimal reproducible code
Steps to reproduce the bug with the above code
Actual Behaviour
According to the documentation of
required()
, it should be overridden by conflicting rules. This should includeexclusive
, since it states that it conflicts with all other arguments.Expected Behaviour
When not specifying the input argument the following error occurs:
When specifying the required argument
the program will still throw an error because the exclusive argument is not exlusive.
Additional Context
No response
Debug Output
[ clap::build::command] App::_do_parse
[ clap::build::command] App::_build
[ clap::build::command] App::_propagate:bug
[ clap::build::command] App::_check_help_and_version: bug
[ clap::build::command] App::_check_help_and_version: Removing generated version
[ clap::build::command] App::_propagate_global_args:bug
[ clap::build::command] App::_derive_display_order:bug
[ clap::build::debug_asserts] Command::_debug_asserts
[ clap::build::debug_asserts] Arg::_debug_asserts:help
[ clap::build::debug_asserts] Arg::_debug_asserts:test
[ clap::build::debug_asserts] Arg::_debug_asserts:input
[ clap::build::debug_asserts] Command::_verify_positionals
[ clap::parse::parser] Parser::get_matches_with
[ clap::parse::parser] Parser::get_matches_with: Begin parsing 'RawOsStr("--test")' ([45, 45, 116, 101, 115, 116])
[ clap::parse::parser] Parser::get_matches_with: Positional counter...1
[ clap::parse::parser] Parser::get_matches_with: Low index multiples...false
[ clap::parse::parser] Parser::possible_subcommand: arg=RawOsStr("--test")
[ clap::parse::parser] Parser::get_matches_with: sc=None
[ clap::parse::parser] Parser::parse_long_arg
[ clap::parse::parser] Parser::parse_long_arg: cur_idx:=1
[ clap::parse::parser] Parser::parse_long_arg: Does it contain '='...
[ clap::parse::parser] No
[ clap::parse::parser] Parser::parse_long_arg: Found valid opt or flag '--test'
[ clap::parse::parser] Parser::check_for_help_and_version_str
[ clap::parse::parser] Parser::check_for_help_and_version_str: Checking if --RawOsStr("test") is help or version...
[ clap::parse::parser] Neither
[ clap::parse::parser] Parser::parse_long_arg: Presence validated
[ clap::parse::parser] Parser::parse_flag
[ clap::parse::parser] Parser::remove_overrides: id=test
[ clap::parse::arg_matcher] ArgMatcher::inc_occurrence_of_arg: id=test
[ clap::build::command] App::groups_for_arg: id=test
[ clap::parse::parser] Parser::get_matches_with: After parse_long_arg ValuesDone
[ clap::parse::validator] Validator::validate
[ clap::parse::parser] Parser::add_defaults
[ clap::parse::parser] Parser::add_defaults:iter:input:
[ clap::parse::parser] Parser::add_value: doesn't have conditional defaults
[ clap::parse::parser] Parser::add_value:iter:input: doesn't have default vals
[ clap::parse::parser] Parser::add_value:iter:input: doesn't have default missing vals
[ clap::parse::validator] Validator::validate_conflicts
[ clap::parse::validator] Validator::validate_exclusive
[ clap::parse::validator] Validator::validate_exclusive:iter:test
[ clap::parse::validator] Validator::validate_conflicts::iter: id=test
[ clap::parse::validator] Conflicts::gather_conflicts
[ clap::parse::validator] Validator::validate_required: required=ChildGraph([Child { id: input, children: [] }])
[ clap::parse::validator] Validator::gather_requires
[ clap::parse::validator] Validator::gather_requires:iter:test
[ clap::parse::validator] Validator::validate_required:iter:aog=input
[ clap::parse::validator] Validator::validate_required:iter: This is an arg
[ clap::parse::validator] Validator::is_missing_required_ok: input
[ clap::parse::validator] Validator::validate_arg_conflicts: a="input"
[ clap::parse::validator] Validator::missing_required_error; incl=[]
[ clap::parse::validator] Validator::missing_required_error: reqs=ChildGraph([Child { id: input, children: [] }])
[ clap::output::usage] Usage::get_required_usage_from: incls=[], matcher=true, incl_last=true
[ clap::output::usage] Usage::get_required_usage_from: unrolled_reqs={input}
[ clap::output::usage] Usage::get_required_usage_from:iter:input
[ clap::output::usage] Usage::get_required_usage_from: ret_val=[""]
[ clap::parse::validator] Validator::missing_required_error: req_args=[
"",
]
[ clap::output::usage] Usage::create_usage_with_title
[ clap::output::usage] Usage::create_usage_no_title
[ clap::output::usage] Usage::create_smart_usage
[ clap::output::usage] Usage::get_required_usage_from: incls=[test], matcher=false, incl_last=true
[ clap::output::usage] Usage::get_required_usage_from: unrolled_reqs={input}
[ clap::output::usage] Usage::get_required_usage_from:iter:test
[ clap::output::usage] Usage::get_required_usage_from:iter:input
[ clap::output::usage] Usage::get_required_usage_from: ret_val=["--test", ""]
[ clap::build::command] App::color: Color setting...
[ clap::build::command] Auto
error: The following required arguments were not provided:
USAGE:
bug --test
For more information try --help
The text was updated successfully, but these errors were encountered: