Class CommandLine.NoOpParameterPreprocessor
- All Implemented Interfaces:
CommandLine.IParameterPreprocessor
- Enclosing class:
CommandLine
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
int
hashCode()
boolean
preprocess
(Stack<String> args, CommandLine.Model.CommandSpec commandSpec, CommandLine.Model.ArgSpec argSpec, Map<String, Object> info) Called when either the command, option or positional parameter that has this preprocessor configured was recognized by the picocli parser.
-
Constructor Details
-
NoOpParameterPreprocessor
private NoOpParameterPreprocessor()
-
-
Method Details
-
preprocess
public boolean preprocess(Stack<String> args, CommandLine.Model.CommandSpec commandSpec, CommandLine.Model.ArgSpec argSpec, Map<String, Object> info) Description copied from interface:CommandLine.IParameterPreprocessor
Called when either the command, option or positional parameter that has this preprocessor configured was recognized by the picocli parser.Implementors are free to modify one or more of the specified command line arguments before they are processed by the picocli parser (or by the option's
parameter consumer
, if one is specified).Implementors may optionally consume one or more of the specified command line arguments: a return value of
true
signals that the preprocessor consumed the parameter: picocli should skip further processing of this option or positional parameter, and the preprocessor implementation takes responsibility for assigning the option or positional parameter a value. A return value offalse
means that picocli should process the stack as usual for this option or positional parameter, and picocli is responsible for assigning this option or positional parameter a value.For a command, returning
true
signals that the preprocessor takes responsibility for parsing all options and positional parameters for this command, and takes responsibility for validating constraints like whether all required options and positional parameters were specified. A return value offalse
means that picocli should process the stack as usual for this command, and picocli is responsible for validation. Command preprocessors can signal back to the picocli parser when they detect that the user requested version information or usage help by putting a value oftrue
in the specifiedinfo
map for keysversionHelpRequested
orusageHelpRequested
, respectively.If the user input is invalid, implementations should throw a
CommandLine.ParameterException
with a message to display to the user.- Specified by:
preprocess
in interfaceCommandLine.IParameterPreprocessor
- Parameters:
args
- the remaining command line arguments that follow the matched argument (the matched argument is not on the stack anymore)commandSpec
- the command or subcommand that was matched (if the specifiedargSpec
isnull
), or the command that the matched option or positional parameter belongs toargSpec
- the option or positional parameter for which to pre-process command line arguments (may benull
when this method is called for a subcommand that was matched)info
- a map containing additional information on the current parser state, including whether the option parameter was attached to the option name with a `=` separator, whether quotes have already been stripped off the option, etc. Implementations may modify this map to communicate back to the picocli parser. Supported values:Supported values in the info Map key valid values type separator '' (empty string): attached without separator, ' ' (space): not attached, (any other string): option name was attached to option param with specified separator java.lang.String negated true
: the option or positional parameter is a negated option/parameter,false
: the option or positional parameter is not a negated option/parameterjava.lang.Boolean unquoted true
: quotes surrounding the value have already been stripped off,false
: quotes surrounding the value have not yet been stripped offjava.lang.Boolean versionHelpRequested true
: version help was requested,false
: version help was not requestedjava.lang.Boolean usageHelpRequested true
: usage help was requested,false
: usage help was not requestedjava.lang.Boolean - Returns:
- true if the preprocessor consumed the parameter and picocli should skip further processing of the stack for this option or positional parameter; false if picocli should continue processing the stack for this option or positional parameter
-
equals
-
hashCode
public int hashCode()
-