Commons-cli dependent arguments

I am using apache commons-cli for a command line tool. I have pairs of dependent arguments, for example, argument B only makes sense if argument A. is present. This will have 2 advantages: automatic warning / error and a more useful usage indicator. Does this support commons-cli?

+6
source share
1 answer

This is not true; You must force these actions manually. The CLI has OptionGroup s, but they are exclusively mutually exclusive options, not dependent. See JavaDoc for Option , OptionBuilder (which I highly recommend using) and the previously mentioned OptionGroup.

+6
source

All Articles