Package picocli
Class CommandLine.ParseResult.Builder
java.lang.Object
picocli.CommandLine.ParseResult.Builder
- Enclosing class:
CommandLine.ParseResult
Builds immutable
ParseResult
instances.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final CommandLine.Model.CommandSpec
private int
private final CommandLine.ParseResult.GroupMatchContainer
(package private) boolean
private final List
<CommandLine.Model.ArgSpec> private final List
<CommandLine.Model.OptionSpec> private final List
<CommandLine.Model.PositionalParamSpec> private final Set
<CommandLine.Model.OptionSpec> private final List
<List<CommandLine.Model.PositionalParamSpec>> private final Set
<CommandLine.Model.PositionalParamSpec> private final List
<CommandLine.ParseResult> private boolean
private boolean
-
Constructor Summary
Constructors -
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.(package private) void
addOriginalStringValue
(CommandLine.Model.ArgSpec argSpec, String value) addPositionalParam
(CommandLine.Model.PositionalParamSpec positionalParam, int position) Adds the specifiedPositionalParamSpec
to the list of parameters that were matched on the command line.(package private) void
addStringValue
(CommandLine.Model.ArgSpec argSpec, String value) (package private) void
addTypedValues
(CommandLine.Model.ArgSpec argSpec, int position, Object typedValue) private CommandLine.ParseResult.Builder
addUnmatched
(int position, String arg) Adds the specified command line argument to the list of unmatched command line arguments, and remembers the position of this argument.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.(package private) void
build()
Creates and returns a newParseResult
instance for this builder's configuration.expandedArgs
(Collection<String> expandedArgs) Sets the specified command line arguments after @-files were expanded; these are the arguments that were actually parsed.private void
nowProcessing
(CommandLine.Model.ArgSpec spec, Object value) originalArgs
(String[] originalArgs) Sets the specified original command line arguments that were passed to theCommandLine.parseArgs(String...)
method, before @-file expansion.subcommand
(CommandLine.ParseResult subcommand) Sets the specifiedParseResult
for a subcommand that was matched on the command line.private int
-
Field Details
-
commandSpec
-
matchedArgsList
-
matchedOptionsList
-
matchedPositionalsList
-
options
-
positionals
-
unmatched
-
firstUnmatchedPosition
private int firstUnmatchedPosition -
originalArgList
-
expandedArgList
-
positionalParams
-
subcommands
-
usageHelpRequested
private boolean usageHelpRequested -
versionHelpRequested
private boolean versionHelpRequested -
isInitializingDefaultValues
boolean isInitializingDefaultValues -
errors
-
nowProcessing
-
groupMatchContainer
-
-
Constructor Details
-
Builder
-
-
Method Details
-
build
Creates and returns a newParseResult
instance for this builder's configuration. -
nowProcessing
-
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, and remembers the position of this argument. This position is used in the UnmatchedArgumentException message.- Since:
- 4.6
-
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. -
totalArgCount
private int totalArgCount() -
subcommand
Sets the specifiedParseResult
for a subcommand that was matched on the command line. -
originalArgs
Sets the specified original command line arguments that were passed to theCommandLine.parseArgs(String...)
method, before @-file expansion.- See Also:
-
expandedArgs
Sets the specified command line arguments after @-files were expanded; these are the arguments that were actually parsed.- Since:
- 4.4
- See Also:
-
addStringValue
-
addOriginalStringValue
-
addTypedValues
-
addError
-
beforeMatchingGroupElement
- Throws:
Exception
-