Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

commons-cli dependent arguments

I use apache commons-cli for a command line tool. I have pairs of dependent arguments, e.g argument B makes sense only if argument A is present. That will have 2 benefits : automatic warning/error and a more usefull usage statment . Does commons-cli support it ?

like image 423
Bax Avatar asked Apr 13 '13 06:04

Bax


1 Answers

It does not; you have to enforce such things manually. CLI has OptionGroups, but they are purely mutually exclusive options, not dependent options. See JavaDoc for Option, OptionBuilder (which I highly recommend using) and the previously mentioned OptionGroup.

like image 115
Joe Casadonte Avatar answered Sep 25 '22 20:09

Joe Casadonte