Uses of Class
picocli.CommandLine
-
Uses of CommandLine in picocli
Fields in picocli declared as CommandLineModifier and TypeFieldDescription(package private) final CommandLine
AutoComplete.CommandDescriptor.commandLine
private final CommandLine
CommandLine.ExecutionException.commandLine
private CommandLine
CommandLine.Model.CommandSpec.commandLine
protected final CommandLine
CommandLine.ParameterException.commandLine
private CommandLine
CommandLine.HelpCommand.self
Fields in picocli with type parameters of type CommandLineModifier and TypeFieldDescriptionprivate final CommandLine.Model.CaseAwareLinkedMap
<String, CommandLine> CommandLine.Model.CommandSpec.commands
Methods in picocli that return CommandLineModifier and TypeMethodDescriptionAdds the options and positional parameters in the specified mixin to this command.CommandLine.addSubcommand
(Object command) Registers a subcommand with the name obtained from the@Command(name = "...")
annotation attribute of the specified command.CommandLine.addSubcommand
(String name, Object command) Registers a subcommand with the specified name.CommandLine.addSubcommand
(String name, Object command, String... aliases) Registers a subcommand with the specified name and all specified aliases.CommandLine.Model.CommandSpec.commandLine()
Returns the CommandLine constructed with thisCommandSpec
model.private CommandLine
CommandLine.copy()
CommandLine.ExecutionException.getCommandLine()
Returns theCommandLine
object for the (sub)command that could not be invoked.CommandLine.ParameterException.getCommandLine()
Returns theCommandLine
object for the (sub)command whose input could not be parsed.CommandLine.getParent()
Returns the command that this is a subcommand of, ornull
if this is a top-level command.<K> CommandLine
CommandLine.registerConverter
(Class<K> cls, CommandLine.ITypeConverter<K> converter) Registers the specified type converter for the specified class.CommandLine.Model.CommandSpec.removeSubcommand
(String name) Removes the subcommand with the specified name or alias from this CommandSpec and returns theCommandLine
instance that was associated with the specified name, ornull
of the specified name was not associated with a subcommand.CommandLine.setAbbreviatedOptionsAllowed
(boolean newValue) Sets whether abbreviated option names should be matched.CommandLine.setAbbreviatedSubcommandsAllowed
(boolean newValue) Sets whether abbreviated subcommands should be matched.CommandLine.setAdjustLineBreaksForWideCJKCharacters
(boolean adjustForWideChars) Sets whether line breaks should take wide Chinese, Japanese and Korean characters into account, and returns this UsageMessageSpec.CommandLine.setAllowOptionsAsOptionParameters
(boolean newValue) Sets whether options can have parameter values that match the name of an option in this command, or whether such values should be rejected with a missing parameter exception.CommandLine.setAllowSubcommandsAsOptionParameters
(boolean newValue) Sets whether options can have parameter values that match subcommand names or aliases, or whether such values should be rejected with a missing parameter exception.CommandLine.setAtFileCommentChar
(Character atFileCommentChar) Sets the character that starts a single-line comment ornull
if all content of argument files should be interpreted as arguments (without comments).CommandLine.setCaseInsensitiveEnumValuesAllowed
(boolean newValue) Sets whether the parser should ignore case when converting arguments toenum
values.CommandLine.setColorScheme
(CommandLine.Help.ColorScheme colorScheme) Sets the color scheme to use when printing help.CommandLine.setCommandName
(String commandName) Sets the command name (also called program name) displayed in the usage help synopsis to the specified value.CommandLine.setDefaultValueProvider
(CommandLine.IDefaultValueProvider newValue) Sets a default value provider for the command and sub-commandsCommandLine.setEndOfOptionsDelimiter
(String delimiter) Sets the end-of-options delimiter that signals that the remaining command line arguments should be treated as positional parameters.CommandLine.setErr
(PrintWriter err) Sets the writer to use when printing diagnostic (error) messages during command execution.CommandLine.setExecutionExceptionHandler
(CommandLine.IExecutionExceptionHandler executionExceptionHandler) Sets a custom handler for dealing with exceptions that occurred in theCallable
,Runnable
orMethod
user object of a command when the command was executed via the execute method.CommandLine.setExecutionStrategy
(CommandLine.IExecutionStrategy executionStrategy) Sets the execution strategy that theexecute
method should use to invoke the business logic on the user objects of this command and/or the user-specified subcommand(s).CommandLine.setExitCodeExceptionMapper
(CommandLine.IExitCodeExceptionMapper exitCodeExceptionMapper) Sets the mapper used by theexecute
method to map exceptions to exit codes.CommandLine.setExpandAtFiles
(boolean expandAtFiles) Sets whether arguments starting with'@'
should be treated as the path to an argument file and its contents should be expanded into separate arguments for each line in the specified file.CommandLine.setHelpFactory
(CommandLine.IHelpFactory helpFactory) Sets a newIHelpFactory
to customize the usage help message.CommandLine.setHelpSectionKeys
(List<String> keys) Sets the section keys in the order that the usage help message should render the sections.CommandLine.setHelpSectionMap
(Map<String, CommandLine.IHelpSectionRenderer> map) Sets the map of section keys and renderers used to construct the usage help message.CommandLine.setInterpolateVariables
(boolean interpolate) Sets whether variables should be interpolated in String values.CommandLine.setNegatableOptionTransformer
(CommandLine.INegatableOptionTransformer transformer) Sets theINegatableOptionTransformer
used to create the negative form of negatable options.CommandLine.setOptionsCaseInsensitive
(boolean newValue) Sets whether upper case and lower case should be ignored when matching option names.CommandLine.setOut
(PrintWriter out) Sets the writer to use when printing user-requested usage help or version help during command execution.CommandLine.setOverwrittenOptionsAllowed
(boolean newValue) Sets whether options for single-value fields can be specified multiple times on the command line without aCommandLine.OverwrittenOptionException
being thrown.CommandLine.setParameterExceptionHandler
(CommandLine.IParameterExceptionHandler parameterExceptionHandler) Sets the handler for dealing with invalid user input when the command is executed.CommandLine.setPosixClusteredShortOptionsAllowed
(boolean newValue) Sets whether short options like-x -v -f SomeFile
can be clustered together like-xvfSomeFile
.CommandLine.setResourceBundle
(ResourceBundle bundle) Sets the ResourceBundle containing usage help message strings.CommandLine.setSeparator
(String separator) Sets the String the parser uses to separate option names from option values to the specified value.CommandLine.setSplitQuotedStrings
(boolean newValue) Deprecated.Most applications should not change the default.CommandLine.setStopAtPositional
(boolean newValue) Sets whether the parser interprets the first positional parameter as "end of options" so the remaining arguments are all treated as positional parameters.CommandLine.setStopAtUnmatched
(boolean newValue) Sets whether the parser should stop interpreting options and positional parameters as soon as it encounters an unmatched option.CommandLine.setSubcommandsCaseInsensitive
(boolean newValue) Sets whether upper case and lower case should be ignored when matching subcommands.CommandLine.setToggleBooleanFlags
(boolean newValue) Sets whether the value of boolean flag options should be "toggled" when the option is matched.CommandLine.setTrimQuotes
(boolean newValue) Sets whether the parser should trim quotes from command line arguments before processing them.CommandLine.setUnmatchedArgumentsAllowed
(boolean newValue) Sets whether the end user may specify unmatched arguments on the command line without aCommandLine.UnmatchedArgumentException
being thrown.CommandLine.setUnmatchedOptionsAllowedAsOptionParameters
(boolean newValue) Sets whether options can have parameter values that resemble an option, or whether such values should be rejected as unknown options.CommandLine.setUnmatchedOptionsArePositionalParams
(boolean newValue) Sets whether arguments on the command line that resemble an option should be treated as positional parameters.CommandLine.setUsageHelpAutoWidth
(boolean detectTerminalSize) Sets whether picocli should attempt to detect the terminal size and adjust the usage help message width to take the full terminal width.CommandLine.setUsageHelpLongOptionsMaxWidth
(int columnWidth) Returns the maximum usage help long options column max width to the specified value.CommandLine.setUsageHelpWidth
(int width) Sets the maximum width of the usage help message.CommandLine.setUseSimplifiedAtFiles
(boolean simplifiedAtFiles) Sets whether to use a simplified argument file format that is compatible with JCommander.private static CommandLine
CommandLine.toCommandLine
(Object obj, CommandLine.IFactory factory) Methods in picocli that return types with arguments of type CommandLineModifier and TypeMethodDescriptionCommandLine.ParseResult.asCommandLineList()
Returns thisParseResult
as a list ofCommandLine
objects, one for each matched command/subcommand.(package private) static List
<CommandLine> CommandLine.Model.CommandSpec.createMethodSubcommands
(Class<?> cls, CommandLine.IFactory factory, boolean includeInherited) CommandLine.getSubcommands()
Returns a map with the subcommands registered on this instance.(package private) List
<CommandLine> Entry point into parsing command line arguments.Deprecated.useparseArgs(String...)
insteadprivate List
<CommandLine> CommandLine.ParseResult.recursivelyAddCommandLineTo
(List<CommandLine> result) CommandLine.Model.CommandSpec.subcommands()
Returns a read-only view of the subcommand map.Methods in picocli with parameters of type CommandLineModifier and TypeMethodDescriptionprivate void
CommandLine.Model.CommandSpec.addAlias
(String alias, String name, CommandLine subCommandLine, CommandLine.Tracer t) (package private) void
CommandLine.ParseResult.GroupMatchContainer.addMatch
(CommandLine commandLine) CommandLine.Model.CommandSpec.addSubcommand
(String name, CommandLine subCommandLine) Adds the specified subcommand with the specified name.static void
AutoComplete.bash
(String scriptName, File out, File command, CommandLine commandLine) Generates source code for an autocompletion bash script for the specified picocli-based application, and writes this script to the specifiedout
file, and optionally writes an invocation script to the specifiedcommand
file.static String
AutoComplete.bash
(String scriptName, CommandLine commandLine) Generates and returns the source code for an autocompletion bash script for the specified picocli-based application.protected CommandLine.Model.CommandSpec
CommandLine.Model.CommandSpec.commandLine
(CommandLine commandLine) Sets the CommandLine constructed with thisCommandSpec
model.(package private) void
CommandLine.ParseResult.GroupMatchContainer.complete
(CommandLine commandLine) private static CommandLine.MissingParameterException
CommandLine.MissingParameterException.create
(CommandLine cmd, Collection<CommandLine.Model.ArgSpec> missing, String separator) private static CommandLine.ParameterException
CommandLine.ParameterException.create
(CommandLine cmd, Exception ex, String arg, int i, String[] args) CommandLine.ParseResult.GroupMatchContainer.createGroupMatchContainer
(CommandLine.Model.ArgGroupSpec group, CommandLine.ParseResult.GroupMatchContainer parent, CommandLine commandLine) private static List
<AutoComplete.CommandDescriptor> AutoComplete.createHierarchy
(String scriptName, CommandLine commandLine) private static void
AutoComplete.createSubHierarchy
(String scriptName, String parentWithoutTopLevelCommand, CommandLine commandLine, List<AutoComplete.CommandDescriptor> out) private static String
CommandLine.UnmatchedArgumentException.describe
(List<String> unmatch, CommandLine cmd) CommandLine.executeUserObject
(CommandLine parsed, List<Object> executionResultList) private void
CommandLine.ParseResult.GroupMatchContainer.failGroupMultiplicityExceeded
(List<CommandLine.ParseResult.GroupMatch> groupMatches, CommandLine commandLine) CommandLine.ParseResult.GroupMatchContainer.findOrCreateMatchingGroup
(CommandLine.Model.ArgSpec argSpec, CommandLine commandLine) private static String
AutoComplete.generateEntryPointFunction
(String scriptName, CommandLine commandLine, List<AutoComplete.CommandDescriptor> hierarchy) private static String
AutoComplete.generateFunctionForCommand
(String functionName, String commandName, CommandLine commandLine) int
CommandLine.IExecutionExceptionHandler.handleExecutionException
(Exception ex, CommandLine commandLine, CommandLine.ParseResult fullParseResult) Handles anException
that occurred while executing theRunnable
orCallable
command and returns an exit code suitable for returning fromexecute(String...)
.private static int
CommandLine.handleUnhandled
(Exception ex, CommandLine cmd, int defaultExitCode) void
CommandLine.HelpCommand.init
(CommandLine helpCommandLine, CommandLine.Help.Ansi ansi, PrintStream out, PrintStream err) Deprecated.void
CommandLine.HelpCommand.init
(CommandLine helpCommandLine, CommandLine.Help.ColorScheme colorScheme, PrintWriter out, PrintWriter err) Initializes this object with the information needed to implement a help command that provides usage help for other commands.void
CommandLine.IHelpCommandInitializable.init
(CommandLine helpCommandLine, CommandLine.Help.Ansi ansi, PrintStream out, PrintStream err) Deprecated.void
CommandLine.IHelpCommandInitializable2.init
(CommandLine helpCommandLine, CommandLine.Help.ColorScheme colorScheme, PrintWriter outWriter, PrintWriter errWriter) Initializes this object with the information needed to implement a help command that provides usage help for other commands.(package private) void
CommandLine.Model.ArgGroupSpec.initUserObject
(CommandLine commandLine) private static boolean
CommandLine.UnmatchedArgumentException.isUnknownOption
(List<String> unmatch, CommandLine cmd) static <T> CommandLine.AbbreviationMatcher.MatchResult
<T> CommandLine.AbbreviationMatcher.match
(Map<String, T> map, String abbreviation, boolean caseInsensitive, CommandLine source) Returns the non-abbreviated name if found, otherwise returns the specified original abbreviation name.private void
CommandLine.Interpreter.processSubcommand
(CommandLine subcommand, CommandLine.ParseResult.Builder builder, List<CommandLine> parsedCommands, Stack<String> args, Collection<CommandLine.Model.ArgSpec> required, Set<CommandLine.Model.ArgSpec> initialized, String[] originalArgs, List<Object> nowProcessing, String separator, String arg) private void
CommandLine.Model.CommandSpec.removeAlias
(String alias, CommandLine subCommandLine, CommandLine.Tracer t) <T> T
CommandLine.Model.ArgSpec.setValue
(T newValue, CommandLine commandLine) Deprecated.useCommandLine.Model.ArgSpec.setValue(Object)
instead.private boolean
CommandLine.ParseResult.GroupMatchContainer.simplifyErrorMessageForSingleGroup
(Map<CommandLine.Model.ArgGroupSpec, List<List<CommandLine.ParseResult.GroupMatch>>> matchesPerGroup, CommandLine commandLine) (package private) void
CommandLine.Model.ArgGroupSpec.tryInitUserObject
(CommandLine commandLine) CommandLine.Model.ArgGroupSpec.validate
(CommandLine commandLine, int presentCount, boolean haveMissing, boolean someButNotAllSpecified, String exclusiveElements, String requiredElements, String missingElements) (package private) void
CommandLine.ParseResult.GroupMatch.validate
(CommandLine commandLine) (package private) void
CommandLine.ParseResult.GroupMatchContainer.validate
(CommandLine commandLine) (package private) CommandLine.ParseResult.GroupValidationResult
CommandLine.Model.ArgGroupSpec.validateArgs
(CommandLine commandLine, Collection<CommandLine.Model.ArgSpec> matchedArgs) private void
CommandLine.ParseResult.GroupMatchContainer.validateGroupMultiplicity
(CommandLine commandLine) Method parameters in picocli with type arguments of type CommandLineModifier and TypeMethodDescriptionCommandLine.Help.addAllSubcommands
(Map<String, CommandLine> subcommands) Registers all specified subcommands with this Help.(package private) static Integer
CommandLine.executeHelpRequest
(List<CommandLine> parsedCommands) CommandLine.RunLast.executeUserObjectOfLastSubcommandWithSameParent
(List<CommandLine> parsedCommands) CommandLine.IParseResultHandler.handleParseResult
(List<CommandLine> parsedCommands, PrintStream out, CommandLine.Help.Ansi ansi) Deprecated.Processes a List ofCommandLine
objects resulting from successfully parsing the command line arguments and optionally returns a list of results.CommandLine.RunAll.handleParseResult
(List<CommandLine> parsedCommands, PrintStream out, CommandLine.Help.Ansi ansi) Prints help if requested, and otherwise executes the top-level command and all subcommands asRunnable
,Callable
orMethod
.CommandLine.RunFirst.handleParseResult
(List<CommandLine> parsedCommands, PrintStream out, CommandLine.Help.Ansi ansi) Prints help if requested, and otherwise executes the top-levelRunnable
orCallable
command.CommandLine.RunLast.handleParseResult
(List<CommandLine> parsedCommands, PrintStream out, CommandLine.Help.Ansi ansi) Prints help if requested, and otherwise executes the most specificRunnable
orCallable
subcommand.private static int
CommandLine.RunLast.indexOfLastSubcommandWithSameParent
(List<CommandLine> parsedCommands) private void
CommandLine.Interpreter.parse
(List<CommandLine> parsedCommands, Stack<String> argumentStack, String[] originalArgs, List<Object> nowProcessing, Collection<CommandLine.Model.ArgSpec> inheritedRequired) private void
CommandLine.Interpreter.parse
(List<CommandLine> parsedCommands, Stack<String> argumentStack, String[] originalArgs, List<Object> nowProcessing, Collection<CommandLine.Model.ArgSpec> inheritedRequired, Set<CommandLine.Model.ArgSpec> initialized) static boolean
CommandLine.printHelpIfRequested
(List<CommandLine> parsedCommands, PrintStream out, PrintStream err, CommandLine.Help.Ansi ansi) Deprecated.useexecuteHelpRequest(ParseResult)
insteadstatic boolean
CommandLine.printHelpIfRequested
(List<CommandLine> parsedCommands, PrintStream out, PrintStream err, CommandLine.Help.ColorScheme colorScheme) Deprecated.useexecuteHelpRequest(ParseResult)
insteadstatic boolean
CommandLine.printHelpIfRequested
(List<CommandLine> parsedCommands, PrintStream out, CommandLine.Help.Ansi ansi) Deprecated.useprintHelpIfRequested(ParseResult)
insteadprivate void
CommandLine.Interpreter.processArguments
(List<CommandLine> parsedCommands, Stack<String> args, Collection<CommandLine.Model.ArgSpec> required, Set<CommandLine.Model.ArgSpec> initialized, String[] originalArgs, List<Object> nowProcessing) private void
CommandLine.Interpreter.processSubcommand
(CommandLine subcommand, CommandLine.ParseResult.Builder builder, List<CommandLine> parsedCommands, Stack<String> args, Collection<CommandLine.Model.ArgSpec> required, Set<CommandLine.Model.ArgSpec> initialized, String[] originalArgs, List<Object> nowProcessing, String separator, String arg) private List
<CommandLine> CommandLine.ParseResult.recursivelyAddCommandLineTo
(List<CommandLine> result) private void
CommandLine.Help.registerSubcommands
(Map<String, CommandLine> subcommands) Constructors in picocli with parameters of type CommandLineModifierConstructorDescription(package private)
CommandDescriptor
(String functionName, String parentFunctionName, String parentWithoutTopLevelCommand, String commandName, CommandLine commandLine) ExecutionException
(CommandLine commandLine, String msg) ExecutionException
(CommandLine commandLine, String msg, Throwable t) (package private)
MaxValuesExceededException
(CommandLine commandLine, String msg) MissingParameterException
(CommandLine commandLine, Collection<CommandLine.Model.ArgSpec> missing, String msg) MissingParameterException
(CommandLine commandLine, CommandLine.Model.ArgSpec missing, String msg) MissingTypeConverterException
(CommandLine commandLine, String msg) MutuallyExclusiveArgsException
(CommandLine commandLine, String msg) OverwrittenOptionException
(CommandLine commandLine, CommandLine.Model.ArgSpec overwritten, String msg) ParameterException
(CommandLine commandLine, String msg) Constructs a new ParameterException with the specified CommandLine and error message.ParameterException
(CommandLine commandLine, String msg, Throwable t) Constructs a new ParameterException with the specified CommandLine and error message.ParameterException
(CommandLine commandLine, String msg, Throwable t, CommandLine.Model.ArgSpec argSpec, String value) Constructs a new ParameterException with the specified CommandLine and error message.ParameterException
(CommandLine commandLine, String msg, CommandLine.Model.ArgSpec argSpec, String value) Constructs a new ParameterException with the specified CommandLine and error message.UnmatchedArgumentException
(CommandLine commandLine, String msg) UnmatchedArgumentException
(CommandLine commandLine, List<String> args) UnmatchedArgumentException
(CommandLine commandLine, List<String> args, String extraMsg) UnmatchedArgumentException
(CommandLine commandLine, Stack<String> args)