T - public class ClassicGetOptParser<T> extends AbstractOptionParser<T>
This is the default variant of the parser used by default configuration and since 2.8.2 was updated to be non-greedy
in its value consumption for arity = 1 options. For the old greedy behaviour please use
GreedyClassicGetOptParser instead.
For example consider a command that defines options -a, -b and -c where -b takes a
value (i.e. arity = 1) and the others are flag options. With that definition a user can provide the options
as -abc and that would result in an error because the c is considered an option and not a value for
-b resulting in a ParseOptionMissingValueException being generated.
However an input of -acbfoo would set the -a and -c flags while setting the value of
-b to foo.
| Constructor and Description |
|---|
ClassicGetOptParser() |
| Modifier and Type | Method and Description |
|---|---|
ParseState<T> |
parseOptions(org.apache.commons.collections4.iterators.PeekingIterator<String> tokens,
ParseState<T> state,
List<OptionMetadata> allowedOptions)
Parses one/more options from the token stream
|
findOption, findOption, hasShortNamePrefix, isSeparatorOrOption, noValueForOptiongetTypeConverterpublic ParseState<T> parseOptions(org.apache.commons.collections4.iterators.PeekingIterator<String> tokens, ParseState<T> state, List<OptionMetadata> allowedOptions)
OptionParsertokens - Tokensstate - Current parser stateallowedOptions - Allowed options at this point of the parsingnull if this parser could
not parse the next token as an optionCopyright © 2012–2022. All rights reserved.