Package nz.org.riskscape.picocli
Class CommandLine.ParseResult.Builder
java.lang.Object
nz.org.riskscape.picocli.CommandLine.ParseResult.Builder
- Enclosing class:
- CommandLine.ParseResult
Builds immutable
ParseResult
instances.-
Method Summary
Modifier and TypeMethodDescriptionadd
(CommandLine.Model.ArgSpec arg, int position) Adds the specifiedOptionSpec
orPositionalParamSpec
to the list of options and parameters that were matched on the command line.void
Adds the specifiedOptionSpec
to the list of options that were matched on the command line.addPositionalParam
(CommandLine.Model.PositionalParamSpec positionalParam, int position) Adds the specifiedPositionalParamSpec
to the list of parameters that were matched on the command line.addUnmatched
(String arg) Adds the specified command line argument to the list of unmatched command line arguments.addUnmatched
(Stack<String> args) Adds all elements of the specified command line arguments stack to the list of unmatched command line arguments.build()
Creates and returns a newParseResult
instance for this builder's configuration.originalArgs
(String[] originalArgs) Sets the specified command line arguments that were parsed.subcommand
(CommandLine.ParseResult subcommand) Sets the specifiedParseResult
for a subcommand that was matched on the command line.
-
Method Details
-
build
Creates and returns a newParseResult
instance for this builder's configuration. -
add
Adds the specifiedOptionSpec
orPositionalParamSpec
to the list of options and parameters that were matched on the command line.- Parameters:
arg
- the matchedOptionSpec
orPositionalParamSpec
position
- the command line position at which thePositionalParamSpec
was matched. Ignored forOptionSpec
s.- Returns:
- this builder for method chaining
-
addOption
Adds the specifiedOptionSpec
to the list of options that were matched on the command line. -
addPositionalParam
public CommandLine.ParseResult.Builder addPositionalParam(CommandLine.Model.PositionalParamSpec positionalParam, int position) Adds the specifiedPositionalParamSpec
to the list of parameters that were matched on the command line.- Parameters:
positionalParam
- the matchedPositionalParamSpec
position
- the command line position at which thePositionalParamSpec
was matched.- Returns:
- this builder for method chaining
-
addUnmatched
Adds the specified command line argument to the list of unmatched command line arguments. -
addUnmatched
Adds all elements of the specified command line arguments stack to the list of unmatched command line arguments. -
subcommand
Sets the specifiedParseResult
for a subcommand that was matched on the command line. -
originalArgs
Sets the specified command line arguments that were parsed. -
addError
-