Apache Commons CLI - print trailing arguments in help output

I use Apache Commons CLI 1.2 to parse the command line, which at the end accepts parameters and additional arguments. Example:mycmd -d DIR extra stuff

I know how to get "extra" and "stuff" using CommandLine.getArgs(), but I don't know how to display these extra arguments in my help. When I call like this:

new HelpFormatter().printHelp("mycmd", opts, true);

I get output like:

usage: mycmd -d DIR

no extra arguments. Can someone point me in the right direction?

+3
source share
1 answer

, , :

new HelpFormatter().printHelp("mycmd -d <DIR> extra stuff", opts);

new HelpFormatter().printHelp("mycmd [options] extra stuff", opts);

, , .

+4

All Articles