I used to work with Apache Commons Cli 1.2. I wanted the analyzer to ignore the arguments if they are unknown (not added to the Options-Object).
Example (pseudo code):
Options specialOptions; specialOptions.addOption(null, "help", false, "shows help"); specialOptions.addOption(null, "version", false, "show version"); CommandLineParser parser = new DefaultParser(); CommandLine cmd = parser.parse(options, args);
I used this solution by Pascal Schaefer: can the Apache Commons command line parameter analyzer ignore unknown command line parameters?
This worked well for me on 1.2, and it works great on 1.3.1 as well. But its not recommended. The parser that I used has been replaced with DefaultParser . I looked at the functionality, but there is no such processOptions method.
I really would like to use code that will not be removed in later releases. Anyone have any ideas how to solve this problem?
source share