required_unless, required_unless_one, and required_unless_all for ArgGroup #1801
Labels
A-validators
Area: ArgMatches validation logi
C-enhancement
Category: Raise on the bar on expectations
S-waiting-on-mentor
Status: Needs elaboration on the details before doing a 'Call for participation'
Describe your use case
The issue this aims to solve is the lack of
required_unless
,required_unless_one
, andrequired_unless_all
forArgGroup
. For example, one might have the following:One might imagine a different situation where
required_unless_one
orrequired_unless_all
might be of use as well, but the only short example I could come up with is one demonstrating the use ofrequired_unless
. This reduces the number of lines required to express certain requirements by moving arequired_unless
,required_unless_one
, orrequired_unless_all
method from each argument in the group to a single one on the group itself. This also makes requirements for group arguments more clear and maintainable, as they're located in a single spot instead of on each group argument.Alternatives
It may be possible in some situations to use
required_unless
,required_unless_one
, orrequired_unless_all
on the arguments in the group one might otherwise apply to the group itself, but this would be at least one line per argument, possibly more if the slices forrequired_unless_one
orrequired_unless_all
are particularly long.The text was updated successfully, but these errors were encountered: