Uses of Class
picocli.CommandLine
-
Packages that use CommandLine Package Description picocli Provides classes and interfaces for the main picocli command line parsing andautocompletionfunctionality.picocli.groovy Provides classes and interfaces for integrating picocli with Groovy.picocli.shell.jline3 Provides classes and interfaces for integrating picocli with JLine 3. -
-
Uses of CommandLine in picocli
Fields in picocli declared as CommandLine Modifier and Type Field Description protected CommandLineCommandLine.ParameterException. commandLineMethods in picocli that return CommandLine Modifier and Type Method Description CommandLineCommandLine. addMixin(String name, Object mixin)Adds the options and positional parameters in the specified mixin to this command.CommandLineCommandLine. addSubcommand(Object command)Registers a subcommand with the name obtained from the@Command(name = "...")annotation attribute of the specified command.CommandLineCommandLine. addSubcommand(String name, Object command)Registers a subcommand with the specified name.CommandLineCommandLine. addSubcommand(String name, Object command, String... aliases)Registers a subcommand with the specified name and all specified aliases.CommandLineCommandLine.Model.CommandSpec. commandLine()Returns the CommandLine constructed with thisCommandSpecmodel.CommandLineCommandLine.ExecutionException. getCommandLine()Returns theCommandLineobject for the (sub)command that could not be invoked.CommandLineCommandLine.ParameterException. getCommandLine()Returns theCommandLineobject for the (sub)command whose input could not be parsed.CommandLineCommandLine. getParent()Returns the command that this is a subcommand of, ornullif this is a top-level command.<K> CommandLineCommandLine. registerConverter(Class<K> cls, CommandLine.ITypeConverter<K> converter)Registers the specified type converter for the specified class.CommandLineCommandLine.Model.CommandSpec. removeSubcommand(String name)Removes the subcommand with the specified name or alias from this CommandSpec and returns theCommandLineinstance that was associated with the specified name, ornullof the specified name was not associated with a subcommand.CommandLineCommandLine. setAbbreviatedOptionsAllowed(boolean newValue)Sets whether abbreviated option names should be matched.CommandLineCommandLine. setAbbreviatedSubcommandsAllowed(boolean newValue)Sets whether abbreviated subcommands should be matched.CommandLineCommandLine. setAdjustLineBreaksForWideCJKCharacters(boolean adjustForWideChars)Sets whether line breaks should take wide Chinese, Japanese and Korean characters into account, and returns this UsageMessageSpec.CommandLineCommandLine. 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.CommandLineCommandLine. 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.CommandLineCommandLine. setAtFileCommentChar(Character atFileCommentChar)Sets the character that starts a single-line comment ornullif all content of argument files should be interpreted as arguments (without comments).CommandLineCommandLine. setCaseInsensitiveEnumValuesAllowed(boolean newValue)Sets whether the parser should ignore case when converting arguments toenumvalues.CommandLineCommandLine. setColorScheme(CommandLine.Help.ColorScheme colorScheme)Sets the color scheme to use when printing help.CommandLineCommandLine. setCommandName(String commandName)Sets the command name (also called program name) displayed in the usage help synopsis to the specified value.CommandLineCommandLine. setDefaultValueProvider(CommandLine.IDefaultValueProvider newValue)Sets a default value provider for the command and sub-commandsCommandLineCommandLine. setEndOfOptionsDelimiter(String delimiter)Sets the end-of-options delimiter that signals that the remaining command line arguments should be treated as positional parameters.CommandLineCommandLine. setErr(PrintWriter err)Sets the writer to use when printing diagnostic (error) messages during command execution.CommandLineCommandLine. setExecutionExceptionHandler(CommandLine.IExecutionExceptionHandler executionExceptionHandler)Sets a custom handler for dealing with exceptions that occurred in theCallable,RunnableorMethoduser object of a command when the command was executed via the execute method.CommandLineCommandLine. setExecutionStrategy(CommandLine.IExecutionStrategy executionStrategy)Sets the execution strategy that theexecutemethod should use to invoke the business logic on the user objects of this command and/or the user-specified subcommand(s).CommandLineCommandLine. setExitCodeExceptionMapper(CommandLine.IExitCodeExceptionMapper exitCodeExceptionMapper)Sets the mapper used by theexecutemethod to map exceptions to exit codes.CommandLineCommandLine. 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.CommandLineCommandLine. setHelpFactory(CommandLine.IHelpFactory helpFactory)Sets a newIHelpFactoryto customize the usage help message.CommandLineCommandLine. setHelpSectionKeys(List<String> keys)Sets the section keys in the order that the usage help message should render the sections.CommandLineCommandLine. setHelpSectionMap(Map<String,CommandLine.IHelpSectionRenderer> map)Sets the map of section keys and renderers used to construct the usage help message.CommandLineCommandLine. setInterpolateVariables(boolean interpolate)Sets whether variables should be interpolated in String values.CommandLineCommandLine. setNegatableOptionTransformer(CommandLine.INegatableOptionTransformer transformer)Sets theINegatableOptionTransformerused to create the negative form of negatable options.CommandLineCommandLine. setOptionsCaseInsensitive(boolean newValue)Sets whether upper case and lower case should be ignored when matching option names.CommandLineCommandLine. setOut(PrintWriter out)Sets the writer to use when printing user-requested usage help or version help during command execution.CommandLineCommandLine. setOverwrittenOptionsAllowed(boolean newValue)Sets whether options for single-value fields can be specified multiple times on the command line without aCommandLine.OverwrittenOptionExceptionbeing thrown.CommandLineCommandLine. setParameterExceptionHandler(CommandLine.IParameterExceptionHandler parameterExceptionHandler)Sets the handler for dealing with invalid user input when the command is executed.CommandLineCommandLine. setPosixClusteredShortOptionsAllowed(boolean newValue)Sets whether short options like-x -v -f SomeFilecan be clustered together like-xvfSomeFile.CommandLineCommandLine. setResourceBundle(ResourceBundle bundle)Sets the ResourceBundle containing usage help message strings.CommandLineCommandLine. setSeparator(String separator)Sets the String the parser uses to separate option names from option values to the specified value.CommandLineCommandLine. setSplitQuotedStrings(boolean newValue)Deprecated.Most applications should not change the default.CommandLineCommandLine. 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.CommandLineCommandLine. setStopAtUnmatched(boolean newValue)Sets whether the parser should stop interpreting options and positional parameters as soon as it encounters an unmatched option.CommandLineCommandLine. setSubcommandsCaseInsensitive(boolean newValue)Sets whether upper case and lower case should be ignored when matching subcommands.CommandLineCommandLine. setToggleBooleanFlags(boolean newValue)Sets whether the value of boolean flag options should be "toggled" when the option is matched.CommandLineCommandLine. setTrimQuotes(boolean newValue)Sets whether the parser should trim quotes from command line arguments before processing them.CommandLineCommandLine. setUnmatchedArgumentsAllowed(boolean newValue)Sets whether the end user may specify unmatched arguments on the command line without aCommandLine.UnmatchedArgumentExceptionbeing thrown.CommandLineCommandLine. setUnmatchedOptionsAllowedAsOptionParameters(boolean newValue)Sets whether options can have parameter values that resemble an option, or whether such values should be rejected as unknown options.CommandLineCommandLine. setUnmatchedOptionsArePositionalParams(boolean newValue)Sets whether arguments on the command line that resemble an option should be treated as positional parameters.CommandLineCommandLine. 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.CommandLineCommandLine. setUsageHelpLongOptionsMaxWidth(int columnWidth)Returns the maximum usage help long options column max width to the specified value.CommandLineCommandLine. setUsageHelpWidth(int width)Sets the maximum width of the usage help message.CommandLineCommandLine. setUseSimplifiedAtFiles(boolean simplifiedAtFiles)Sets whether to use a simplified argument file format that is compatible with JCommander.Methods in picocli that return types with arguments of type CommandLine Modifier and Type Method Description List<CommandLine>CommandLine.ParseResult. asCommandLineList()Returns thisParseResultas a list ofCommandLineobjects, one for each matched command/subcommand.Map<String,CommandLine>CommandLine. getSubcommands()Returns a map with the subcommands registered on this instance.List<CommandLine>CommandLine. parse(String... args)Deprecated.useparseArgs(String...)insteadMap<String,CommandLine>CommandLine.Model.CommandSpec. subcommands()Returns a read-only view of the subcommand map.Methods in picocli with parameters of type CommandLine Modifier and Type Method Description CommandLine.Model.CommandSpecCommandLine.Model.CommandSpec. addSubcommand(String name, CommandLine subCommandLine)Adds the specified subcommand with the specified name.static voidAutoComplete. 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 specifiedoutfile, and optionally writes an invocation script to the specifiedcommandfile.static StringAutoComplete. 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.CommandSpecCommandLine.Model.CommandSpec. commandLine(CommandLine commandLine)Sets the CommandLine constructed with thisCommandSpecmodel.intCommandLine.IExecutionExceptionHandler. handleExecutionException(Exception ex, CommandLine commandLine, CommandLine.ParseResult fullParseResult)Handles anExceptionthat occurred while executing theRunnableorCallablecommand and returns an exit code suitable for returning fromexecute(String...).voidCommandLine.HelpCommand. init(CommandLine helpCommandLine, CommandLine.Help.Ansi ansi, PrintStream out, PrintStream err)Deprecated.voidCommandLine.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.voidCommandLine.IHelpCommandInitializable. init(CommandLine helpCommandLine, CommandLine.Help.Ansi ansi, PrintStream out, PrintStream err)Deprecated.voidCommandLine.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.<T> TCommandLine.Model.ArgSpec. setValue(T newValue, CommandLine commandLine)Deprecated.useCommandLine.Model.ArgSpec.setValue(Object)instead.Method parameters in picocli with type arguments of type CommandLine Modifier and Type Method Description CommandLine.HelpCommandLine.Help. addAllSubcommands(Map<String,CommandLine> subcommands)Registers all specified subcommands with this Help.List<Object>CommandLine.IParseResultHandler. handleParseResult(List<CommandLine> parsedCommands, PrintStream out, CommandLine.Help.Ansi ansi)Deprecated.Processes a List ofCommandLineobjects resulting from successfully parsing the command line arguments and optionally returns a list of results.List<Object>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,CallableorMethod.List<Object>CommandLine.RunFirst. handleParseResult(List<CommandLine> parsedCommands, PrintStream out, CommandLine.Help.Ansi ansi)Prints help if requested, and otherwise executes the top-levelRunnableorCallablecommand.List<Object>CommandLine.RunLast. handleParseResult(List<CommandLine> parsedCommands, PrintStream out, CommandLine.Help.Ansi ansi)Prints help if requested, and otherwise executes the most specificRunnableorCallablesubcommand.static booleanCommandLine. printHelpIfRequested(List<CommandLine> parsedCommands, PrintStream out, PrintStream err, CommandLine.Help.Ansi ansi)Deprecated.useexecuteHelpRequest(ParseResult)insteadstatic booleanCommandLine. printHelpIfRequested(List<CommandLine> parsedCommands, PrintStream out, PrintStream err, CommandLine.Help.ColorScheme colorScheme)Deprecated.useexecuteHelpRequest(ParseResult)insteadstatic booleanCommandLine. printHelpIfRequested(List<CommandLine> parsedCommands, PrintStream out, CommandLine.Help.Ansi ansi)Deprecated.useprintHelpIfRequested(ParseResult)insteadConstructors in picocli with parameters of type CommandLine Constructor Description ExecutionException(CommandLine commandLine, String msg)ExecutionException(CommandLine commandLine, String msg, Throwable t)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) -
Uses of CommandLine in picocli.groovy
Methods in picocli.groovy that return CommandLine Modifier and Type Method Description protected CommandLinePicocliBaseScript2. beforeParseArgs(CommandLine customizable)Customizes the specifiedCommandLineinstance to set a customIParameterExceptionHandlerand a customIExecutionExceptionHandler, subclasses can override to customize further.CommandLinePicocliBaseScript. createCommandLine()Deprecated.Create and returns a new CommandLine instance.CommandLinePicocliBaseScript2. createCommandLine()Create and returns a new CommandLine instance.protected CommandLinePicocliBaseScript. getOrCreateCommandLine()Deprecated.Return the CommandLine for this script.protected CommandLinePicocliBaseScript2. getOrCreateCommandLine()Returns the CommandLine for this script.Methods in picocli.groovy that return types with arguments of type CommandLine Modifier and Type Method Description List<CommandLine>PicocliBaseScript. parseScriptArguments(CommandLine commandLine, String[] args)Deprecated.Returns the result of callingparse(String...)with the given arguments.Methods in picocli.groovy with parameters of type CommandLine Modifier and Type Method Description protected ObjectPicocliBaseScript2. afterExecution(CommandLine commandLine, int exitCode, Exception exception)This method is called after the script has been executed, and may do one of three things: CallSystem.exitwith the specified exit code. Throw aGroovyRuntimeExceptionwith the specified exception. Return the result of the script execution.protected CommandLinePicocliBaseScript2. beforeParseArgs(CommandLine customizable)Customizes the specifiedCommandLineinstance to set a customIParameterExceptionHandlerand a customIExecutionExceptionHandler, subclasses can override to customize further.ObjectPicocliBaseScript. handleExecutionException(CommandLine commandLine, String[] args, Exception ex)Deprecated.If an Exception occurs duringPicocliBaseScript.runRunnableSubcommand(List), orPicocliBaseScript.runScriptBody()then this gets called to report the problem.List<CommandLine>PicocliBaseScript. parseScriptArguments(CommandLine commandLine, String[] args)Deprecated.Returns the result of callingparse(String...)with the given arguments.ObjectPicocliBaseScript. printHelpMessage(CommandLine commandLine)Deprecated.If an @Option whoseusageHelpattribute is annotated as true appears in the arguments.ObjectPicocliBaseScript. printHelpMessage(CommandLine commandLine, PrintStream stream)Deprecated.If an @Option whoseusageHelpattribute is annotated as true appears in the arguments.ObjectPicocliBaseScript. printVersionHelpMessage(CommandLine commandLine)Deprecated.If an @Option whoseversionHelpattribute is annotated as true appears in the arguments.Method parameters in picocli.groovy with type arguments of type CommandLine Modifier and Type Method Description voidPicocliBaseScript. runRunnableSubcommand(List<CommandLine> parsedCommands)Deprecated.If the most specific subcommand (the lastCommandLineobject in the list) implements Runnable or Callable, then run it. -
Uses of CommandLine in picocli.shell.jline3
Constructors in picocli.shell.jline3 with parameters of type CommandLine Constructor Description PicocliCommands(CommandLine cmd)
-