I am trying to build a complex list of arguments without chaining multiple parsers using commons-cli project...
Basically I am trying to understand how the arguments and optional arguments are working together...
Sample Command help
$ admin <endpoint> <update> <name> [<type>] [<endpoint>] [<descriptions>]
//sample option creation for a
options.addOption(OptionBuilder.hasArgs(3).hasOptionalArgs(2)
.withArgName("name> <type> <uri> [<description>] [<endpoint>]")
.withValueSeparator(' ')
.create("add"));
CommandLine line = parser.parse(options, args, true);
The CommandLine does not differentiate between required and optional arguments... how can I retrieve them without have to chain a second parser for the optional options?