I use the Apache Commons CLI to parse command line arguments.
I am looking for a way to display multiple argument value names in the help. The following is an example of a single argument to the "startimport" option:
Option startimport = OptionBuilder .withArgName("environment") .hasArg() .withDescription( "Description") .create("startimport");
When I use -help, it prints:
-startimport <environment> Description
It's good. But what if I want to use two arguments?
Option startimport = OptionBuilder .withArgName("firstArg secondArg") .hasArgs(2) .withDescription("Description") .create("startimport ");
Parsing two arguments is not a problem, but I want to get the following result in "-help":
startimport <firstArg> <secondArg> Description
But for now, I would just get:
startimport <firstArg secondArg> Description
Is there a suitable solution for this problem?
java command-line command-line-interface arguments apache-commons-cli
Metalhead89
source share