Package picocli
Class CommandLine.ParseResult.Builder
- java.lang.Object
-
- picocli.CommandLine.ParseResult.Builder
-
- Enclosing class:
- CommandLine.ParseResult
public static class CommandLine.ParseResult.Builder extends java.lang.ObjectBuilds immutableParseResultinstances.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CommandLine.ParseResult.Builderadd(CommandLine.Model.ArgSpec arg, int position)Adds the specifiedOptionSpecorPositionalParamSpecto the list of options and parameters that were matched on the command line.voidaddError(CommandLine.PicocliException ex)CommandLine.ParseResult.BuilderaddOption(CommandLine.Model.OptionSpec option)Adds the specifiedOptionSpecto the list of options that were matched on the command line.CommandLine.ParseResult.BuilderaddPositionalParam(CommandLine.Model.PositionalParamSpec positionalParam, int position)Adds the specifiedPositionalParamSpecto the list of parameters that were matched on the command line.CommandLine.ParseResult.BuilderaddUnmatched(java.lang.String arg)Adds the specified command line argument to the list of unmatched command line arguments.CommandLine.ParseResult.BuilderaddUnmatched(java.util.Stack<java.lang.String> args)Adds all elements of the specified command line arguments stack to the list of unmatched command line arguments.CommandLine.ParseResultbuild()Creates and returns a newParseResultinstance for this builder's configuration.CommandLine.ParseResult.BuilderexpandedArgs(java.util.Collection<java.lang.String> expandedArgs)Sets the specified command line arguments after @-files were expanded; these are the arguments that were actually parsed.CommandLine.ParseResult.BuilderoriginalArgs(java.lang.String[] originalArgs)Sets the specified original command line arguments that were passed to theCommandLine.parseArgs(String...)method, before @-file expansion.CommandLine.ParseResult.Buildersubcommand(CommandLine.ParseResult subcommand)Sets the specifiedParseResultfor a subcommand that was matched on the command line.
-
-
-
Method Detail
-
build
public CommandLine.ParseResult build()
Creates and returns a newParseResultinstance for this builder's configuration.
-
add
public CommandLine.ParseResult.Builder add(CommandLine.Model.ArgSpec arg, int position)
Adds the specifiedOptionSpecorPositionalParamSpecto the list of options and parameters that were matched on the command line.- Parameters:
arg- the matchedOptionSpecorPositionalParamSpecposition- the command line position at which thePositionalParamSpecwas matched. Ignored forOptionSpecs.- Returns:
- this builder for method chaining
-
addOption
public CommandLine.ParseResult.Builder addOption(CommandLine.Model.OptionSpec option)
Adds the specifiedOptionSpecto 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 specifiedPositionalParamSpecto the list of parameters that were matched on the command line.- Parameters:
positionalParam- the matchedPositionalParamSpecposition- the command line position at which thePositionalParamSpecwas matched.- Returns:
- this builder for method chaining
-
addUnmatched
public CommandLine.ParseResult.Builder addUnmatched(java.lang.String arg)
Adds the specified command line argument to the list of unmatched command line arguments.
-
addUnmatched
public CommandLine.ParseResult.Builder addUnmatched(java.util.Stack<java.lang.String> args)
Adds all elements of the specified command line arguments stack to the list of unmatched command line arguments.
-
subcommand
public CommandLine.ParseResult.Builder subcommand(CommandLine.ParseResult subcommand)
Sets the specifiedParseResultfor a subcommand that was matched on the command line.
-
originalArgs
public CommandLine.ParseResult.Builder originalArgs(java.lang.String[] originalArgs)
Sets the specified original command line arguments that were passed to theCommandLine.parseArgs(String...)method, before @-file expansion.
-
expandedArgs
public CommandLine.ParseResult.Builder expandedArgs(java.util.Collection<java.lang.String> expandedArgs)
Sets the specified command line arguments after @-files were expanded; these are the arguments that were actually parsed.- Since:
- 4.4
- See Also:
originalArgs(String[]),CommandLine.ParseResult.expandedArgs()
-
addError
public void addError(CommandLine.PicocliException ex)
-
-