org.apache.commons.cli
public abstract class Parser extends Object implements CommandLineParser
Field Summary | |
---|---|
CommandLine | cmd commandline instance |
Options | options current Options |
List | requiredOptions list of required options strings |
Method Summary | |
---|---|
void | checkRequiredOptions() Throws a {@link MissingOptionException} if all of the required options are no present. |
protected abstract String[] | flatten(Options opts, String[] arguments, boolean stopAtNonOption) Subclasses must implement this method to reduce
the |
CommandLine | parse(Options options, String[] arguments) Parses the specified |
CommandLine | parse(Options opts, String[] arguments, boolean stopAtNonOption) Parses the specified |
void | processArgs(Option opt, ListIterator iter) |
void | processOption(String arg, ListIterator iter) |
Throws a {@link MissingOptionException} if all of the required options are no present.
Subclasses must implement this method to reduce
the arguments
that have been passed to the parse
method.
Parameters: opts The Options to parse the arguments by. args The arguments that have to be flattened. stopAtNonOption specifies whether to stop flattening when a non option has been encountered
Returns: a String array of the flattened arguments
Parses the specified arguments
based on the specifed {@link Options}.
Parameters: options the Options
arguments the arguments
Returns: the CommandLine
Throws: ParseException if an error occurs when parsing the arguments.
Parses the specified arguments
based on the specifed {@link Options}.
Parameters: options the Options
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.
Returns: the CommandLine
Throws: ParseException if an error occurs when parsing the arguments.