flatten
with required
breaks requirement checking
#5435
Labels
C-bug
Category: Updating dependencies
flatten
with required
breaks requirement checking
#5435
Please complete the following tasks
Rust Version
rustc 1.77.1 (7cf61ebde 2024-03-27)
Clap Version
4.5.4
Minimal reproducible code
Steps to reproduce the bug with the above code
cargo run -- test --help
cargo run -- test
cargo run -- test --all
cargo run -- test --foo --bar
cargo run -- test --all --foo
Actual Behaviour
Expected Behaviour
Passing in
--all
should satisfy the requirement and it shouldn't show an empty list of required arguments.Additional Context
The goal is to either require an individual item or
--all
. Sotest
fails,test --all
andtest --foo --bar
works andtest --all --foo
fails.This is possible by avoiding
flatten
and using conflicts instead:I couldn't figure out a way to use conflicts as a workaround with
flatten
if the group is still required.Also an extra question, I'm unsure if this is the best way to have a flag that essentially sets the values of a set of other flags (without checking if
all
is true and then mutatingfoo
andbar
to true/always checking iffoo
orall
is true). It seems like setting a customaction
wouldn't help here (to setfoo
andbar
to true) but maybe there's a better way of setting up the flags here that avoids this issue.Debug Output
The text was updated successfully, but these errors were encountered: