org.apache.commons.cli
Class Parser
- CommandLineParser
public abstract class Parser
- John Keyes (john at integralsource.com)
options
private Options options
current Options
requiredOptions
private List requiredOptions
list of required options strings
flatten
protected abstract String[] flatten(Options opts,
String[] arguments,
boolean stopAtNonOption)
Subclasses must implement this method to reduce
the arguments
that have been passed to the parse
method.
opts
- The Options to parse the arguments by.stopAtNonOption
- specifies whether to stop
flattening when a non option has been encountered
- a String array of the flattened arguments
parse
public CommandLine parse(Options opts,
String[] arguments,
boolean stopAtNonOption)
throws ParseException
Parses the specified
arguments
based on the specifed
Options
.
- parse in interface CommandLineParser
arguments
- the arguments
stopAtNonOption
- specifies whether to stop
interpreting the arguments when a non option has
been encountered and to add them to the CommandLines
args list.
processOption
private void processOption(String arg,
ListIterator iter)
throws ParseException