| java.lang.Object org.apache.commons.cli.Parser org.apache.commons.cli.PosixParser
Method Summary | |
protected void | burstToken(String token, boolean stopAtNonOption) Breaks token into its constituent parts
using the following algorithm. | protected String[] | flatten(Options options, String[] arguments, boolean stopAtNonOption) An implementation of
Parser 's abstract
Parser.flatten(OptionsString[]boolean) flatten method.
The following are the rules used by this flatten method.
- if
stopAtNonOption is true then do not
burst anymore of arguments entries, just add each
successive entry without further processing. |
burstToken | protected void burstToken(String token, boolean stopAtNonOption)(Code) | | Breaks token into its constituent parts
using the following algorithm.
- ignore the first character ("-")
- foreach remaining character check if an
Option exists with that id.
- if an
Option does exist then add that character
prepended with "-" to the list of processed tokens.
- if the
Option can have an argument value and there
are remaining characters in the token then add the remaining
characters as a token to the list of processed tokens.
- if an
Option does NOT exist AND
stopAtNonOption IS set then add the special token
"--" followed by the remaining characters and also
the remaining tokens directly to the processed tokens list.
- if an
Option does NOT exist AND
stopAtNonOption IS NOT set then add that
character prepended with "-".
Parameters: token - The current token to be burst Parameters: stopAtNonOption - Specifies whether to stop processingat the first non-Option encountered. |
flatten | protected String[] flatten(Options options, String[] arguments, boolean stopAtNonOption)(Code) | | An implementation of
Parser 's abstract
Parser.flatten(OptionsString[]boolean) flatten method.
The following are the rules used by this flatten method.
- if
stopAtNonOption is true then do not
burst anymore of arguments entries, just add each
successive entry without further processing. Otherwise, ignore
stopAtNonOption .
- if the current
arguments entry is "--"
just add the entry to the list of processed tokens
- if the current
arguments entry is "-"
just add the entry to the list of processed tokens
- if the current
arguments entry is two characters
in length and the first character is "-" then check if this
is a valid
Option id. If it is a valid id, then add the
entry to the list of processed tokens and set the current
Option member. If it is not a valid id and stopAtNonOption
is true, then the remaining entries are copied to the list of
processed tokens. Otherwise, the current entry is ignored.
- if the current
arguments entry is more than two
characters in length and the first character is "-" then
we need to burst the entry to determine its constituents. For more
information on the bursting algorithm see
PosixParser.burstToken(Stringboolean) burstToken .
- if the current
arguments entry is not handled
by any of the previous rules, then the entry is added to the list
of processed tokens.
Parameters: options - The command line Options Parameters: arguments - The command line arguments to be parsed Parameters: stopAtNonOption - Specifies whether to stop flatteningwhen an non option is found. The flattened arguments String array. |
Methods inherited from org.apache.commons.cli.Parser | abstract protected String[] flatten(Options opts, String[] arguments, boolean stopAtNonOption)(Code)(Java Doc) public CommandLine parse(Options options, String[] arguments) throws ParseException(Code)(Java Doc) public CommandLine parse(Options options, String[] arguments, Properties properties) throws ParseException(Code)(Java Doc) public CommandLine parse(Options options, String[] arguments, boolean stopAtNonOption) throws ParseException(Code)(Java Doc) public CommandLine parse(Options options, String[] arguments, Properties properties, boolean stopAtNonOption) throws ParseException(Code)(Java Doc) public void processArgs(Option opt, ListIterator iter) throws ParseException(Code)(Java Doc)
|
|
|