fsprojects / Argu

A declarative CLI argument parser for F#
https://fsprojects.github.io/Argu
MIT License
453 stars 75 forks source link

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

Open milbrandt opened 4 years ago

milbrandt commented 4 years ago

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

eiriktsarpalis commented 4 years ago

That's typically handled using subcommands.

milbrandt commented 4 years ago

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.