commandline icon indicating copy to clipboard operation
commandline copied to clipboard

Make Option reuired if another Option is set

Open tomfrenzel opened this issue 4 years ago • 1 comments

Let's say i have the Verb createuser with the Options: Name, Age, Country, ZIPCode and City How can I define, that if Country is set, ZIPCode and City become required?

So the following would be valid: MyApp.dll createuser -n "Name" -a "Age" MyApp.dll createuser -n "Name" -a "Age" -Country "USA" -ZIPCode "12345" -City "NYC"

And this would be Invalid: MyApp.dll createuser -n "Name" -a "Age" -Country "USA" MyApp.dll createuser -n "Name" -a "Age" -ZIPCode "12345" -City "NYC"

tomfrenzel avatar May 05 '21 10:05 tomfrenzel

I definitely need this feature, too. Having options that are mutually exclusive of each other but not exclusive of other groups of options is a necessity, e.g., mycommand (-a|-b) (-c|-d), where -a and -b are exclusive of each other, but they can exist with -c or -d, and -c and -d are mutually exclusive.

(Think plantravel (-f|-c) (-p|-c), where -f means to pack formal clothes, -c means to pack comfortable clothes, -p means to travel by plane, and -c means to travel by car.)

j2bradley avatar Jan 12 '23 00:01 j2bradley