Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Support of "exclusive or" argument sets #144

Open
milbrandt opened this issue Mar 15, 2020 · 2 comments
Open

feat: Support of "exclusive or" argument sets #144

milbrandt opened this issue Mar 15, 2020 · 2 comments

Comments

@milbrandt
Copy link

Description

If the list of arguments contain multiple sets of "exclusive or" options how can this be handled?

Repro steps

test [--option1 | --option2] [--option3 | --option4] [--option5 | --option6] 

Expected behavior

Possibility to group arguments from which exactely one is allowed.

Actual behavior

As far as I understood the tutorial no formal grouping of options is supported today.

Known workarounds

  • Up to two sets of exclusive-or Arguments: A first set can be marked with [<FirstAttribute>], a second set as [<LastAttribute>].
  • Use combinatorics to define "group" Options like option1_option4_option5. Will get cumbersome.
  • use subcommands
@eiriktsarpalis
Copy link
Member

That's typically handled using subcommands.

@milbrandt
Copy link
Author

Yes, this is one of the Workarounds mentioned.
But as far as I understand this requires that from each option group one Argument is selected. At the moment I can't see how to map the case that either a group is omitted or exacteley one is allowed . Continuing the exampe from Repor steps, I want to allow all of the following

test --option1 --option3 --option5
test --option1 --option3
test --option1 --option5
test --option3 --option5
test --option1
test --option3
test --option5
test

whereas e.g. test --option3 --option4 would not be allowed.

@bartelink bartelink changed the title Support of "exclusive or" argument sets feat: Support of "exclusive or" argument sets Dec 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants