picocli

## Class CommandLine

- java.lang.Object
- - picocli.CommandLine

    public class CommandLine
    extends java.lang.Object

CommandLine interpreter that uses reflection to initialize an annotated domain object with values obtained from the command line arguments.

## Example

    import static picocli.CommandLine.*;

     @Command(mixinStandardHelpOptions = true, version = "v3.0.0",
             header = "Encrypt FILE(s), or standard input, to standard output or to the output file.")
     public class Encrypt {

         @Parameters(type = File.class, description = "Any number of input files")
         private List<File> files = new ArrayList<File>();

         @Option(names = { "-o", "--out" }, description = "Output file (default: print to console)")
         private File outputFile;

         @Option(names = { "-v", "--verbose"}, description = "Verbose mode. Helpful for troubleshooting. Multiple -v options increase the verbosity.")
         private boolean[] verbose;
     }

Use `CommandLine` to initialize a domain object as follows:

     public static void main(String... args) {
         Encrypt encrypt = new Encrypt();
         try {
             ParseResult parseResult = new CommandLine(encrypt).parseArgs(args);
             if (!CommandLine.printHelpIfRequested(parseResult)) {
                 runProgram(encrypt);
             }
         } catch (ParameterException ex) { // command line arguments could not be parsed
             System.err.println(ex.getMessage());
             ex.getCommandLine().usage(System.err);
         }
     }

Invoke the above program with some command line arguments. The below are all equivalent:

     --verbose --out=outfile in1 in2
     --verbose --out outfile in1 in2
     -v --out=outfile in1 in2
     -v -o outfile in1 in2
     -v -o=outfile in1 in2
     -vo outfile in1 in2
     -vo=outfile in1 in2
     -v -ooutfile in1 in2
     -vooutfile in1 in2

Another example that implements `Callable` and uses the `CommandLine.call` convenience API to run in a single line of code:

      @Command(description = "Prints the checksum (MD5 by default) of a file to STDOUT.",
              name = "checksum", mixinStandardHelpOptions = true, version = "checksum 3.0")
     class CheckSum implements Callable<Void> {

         @Parameters(index = "0", description = "The file whose checksum to calculate.")
         private File file;

         @Option(names = {"-a", "--algorithm"}, description = "MD5, SHA-1, SHA-256, ...")
         private String algorithm = "MD5";

         public static void main(String[] args) throws Exception {
             // CheckSum implements Callable, so parsing, error handling and handling user
             // requests for usage help or version help can be done with one line of code.
             CommandLine.call(new CheckSum(), args);
         }

         @Override
         public Void call() throws Exception {
             // your business logic goes here...
             byte[] fileContents = Files.readAllBytes(file.toPath());
             byte[] digest = MessageDigest.getInstance(algorithm).digest(fileContents);
             System.out.println(javax.xml.bind.DatatypeConverter.printHexBinary(digest));
             return null;
         }
     }

## Classes and Interfaces for Defining a CommandSpec Model

## Classes Related to Parsing Command Line Arguments

### Nested Class Summary

Nested Classes
`static class` `CommandLine.AbstractHandler<R,T extends CommandLine.AbstractHandler<R,T>>` Abstract superclass for `CommandLine.IParseResultHandler2` and `CommandLine.IExceptionHandler2` implementations.
`static class` `CommandLine.AbstractParseResultHandler<R>` Command line parse result handler that returns a value.
`static interface` `CommandLine.Command` Annotate your class with `@Command` when you want more control over the format of the generated help message.
`static class` `CommandLine.DefaultExceptionHandler<R>` Default exception handler that handles invalid user input by printing the exception message, followed by the usage message for the command or subcommand whose input was invalid.
`static class` `CommandLine.DuplicateOptionAnnotationsException` Exception indicating that multiple fields have been annotated with the same Option name.
`static class` `CommandLine.ExecutionException` Exception indicating a problem while invoking a command or subcommand.
`static class` `CommandLine.Help` A collection of methods and inner classes that provide fine-grained control over the contents and layout of the usage help message to display to end users when help is requested or invalid input values were specified.
`static class` `CommandLine.HelpCommand` Help command that can be installed as a subcommand on all application commands.
`static interface` `CommandLine.IDefaultValueProvider` Provides default value for a command.
`static interface` `CommandLine.IExceptionHandler` Deprecated. Use `CommandLine.IExceptionHandler2` instead.
`static interface` `CommandLine.IExceptionHandler2<R>` Classes implementing this interface know how to handle `ParameterExceptions` (usually from invalid user input) and `ExecutionExceptions` that occurred while executing the `Runnable` or `Callable` command.
`static interface` `CommandLine.IFactory` Factory for instantiating classes that are registered declaratively with annotation attributes, like `CommandLine.Command.subcommands()`, `CommandLine.Option.converter()`, `CommandLine.Parameters.converter()` and `CommandLine.Command.versionProvider()`.
`static interface` `CommandLine.IHelpCommandInitializable` Help commands that provide usage help for other commands can implement this interface to be initialized with the information they need.
`static interface` `CommandLine.IHelpFactory` Creates the `CommandLine.Help` instance used to render the usage help message.
`static interface` `CommandLine.IHelpSectionRenderer` Renders a section of the usage help message.
`static class` `CommandLine.InitializationException` Exception indicating a problem during `CommandLine` initialization.
`static interface` `CommandLine.IParseResultHandler` Deprecated. Use `CommandLine.IParseResultHandler2` instead.
`static interface` `CommandLine.IParseResultHandler2<R>` Represents a function that can process the `ParseResult` object resulting from successfully parsing the command line arguments.
`static interface` `CommandLine.ITypeConverter<K>` When parsing command line arguments and initializing fields annotated with `@Option` or `@Parameters`, String values can be converted to any type for which a `ITypeConverter` is registered.
`static interface` `CommandLine.IVersionProvider` Provides version information for a command.
`static class` `CommandLine.MaxValuesExceededException` Exception indicating that more values were specified for an option or parameter than its `arity` allows.
`static class` `CommandLine.MissingParameterException` Exception indicating that a required parameter was not specified.
`static class` `CommandLine.MissingTypeConverterException` Exception indicating that an annotated field had a type for which no `CommandLine.ITypeConverter` was registered.
`static interface` `CommandLine.Mixin` Fields annotated with `@Mixin` are "expanded" into the current command: `@Option` and `@Parameters` in the mixin class are added to the options and positional parameters of this command.
`static class` `CommandLine.Model` This class provides a namespace for classes and interfaces that model concepts and attributes of command line interfaces in picocli.
`static interface` `CommandLine.Option` Annotate fields in your class with `@Option` and picocli will initialize these fields when matching arguments are specified on the command line.
`static class` `CommandLine.OverwrittenOptionException` Exception indicating that an option for a single-value option field has been specified multiple times on the command line.
`static class` `CommandLine.ParameterException` Exception indicating something went wrong while parsing command line options.
`static class` `CommandLine.ParameterIndexGapException` Exception indicating that there was a gap in the indices of the fields annotated with `CommandLine.Parameters`.
`static interface` `CommandLine.Parameters` Fields annotated with `@Parameters` will be initialized with positional parameters.
`static interface` `CommandLine.ParentCommand` Fields annotated with `@ParentCommand` will be initialized with the parent command of the current subcommand.
`static class` `CommandLine.ParseResult` Encapsulates the result of parsing an array of command line arguments.
`static class` `CommandLine.PicocliException` Base class of all exceptions thrown by `picocli.CommandLine`.
`static class` `CommandLine.Range` Describes the number of parameters required and accepted by an option or a positional parameter.
`static class` `CommandLine.RunAll` Command line parse result handler that prints help if requested, and otherwise executes the top-level command and all subcommands as `Runnable` or `Callable`.
`static class` `CommandLine.RunFirst` Command line parse result handler that prints help if requested, and otherwise executes the top-level `Runnable` or `Callable` command.
`static class` `CommandLine.RunLast` Command line parse result handler that prints help if requested, and otherwise executes the most specific `Runnable` or `Callable` subcommand.
`static interface` `CommandLine.Spec` Fields annotated with `@Spec` will be initialized with the `CommandSpec` for the command the field is part of.
`static class` `CommandLine.TypeConversionException` Exception thrown by `CommandLine.ITypeConverter` implementations to indicate a String could not be converted.
`static interface` `CommandLine.Unmatched` Fields annotated with `@Unmatched` will be initialized with the list of unmatched command line arguments, if any.
`static class` `CommandLine.UnmatchedArgumentException` Exception indicating that a command line argument could not be mapped to any of the fields annotated with `CommandLine.Option` or `CommandLine.Parameters`.

### Field Summary

Fields
`static java.lang.String` `VERSION` This is picocli version "3.9.6".

### Constructor Summary

Constructors
Constructor and Description
`CommandLine(java.lang.Object command)` Constructs a new `CommandLine` interpreter with the specified object (which may be an annotated user object or a `CommandSpec`) and a default subcommand factory.
`CommandLine(java.lang.Object command, CommandLine.IFactory factory)` Constructs a new `CommandLine` interpreter with the specified object (which may be an annotated user object or a `CommandSpec`) and object factory.

### Method Summary

All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods
`CommandLine` `addMixin(java.lang.String name, java.lang.Object mixin)` Adds the options and positional parameters in the specified mixin to this command.
`CommandLine` `addSubcommand(java.lang.String name, java.lang.Object command)` Registers a subcommand with the specified name.
`CommandLine` `addSubcommand(java.lang.String name, java.lang.Object command, java.lang.String... aliases)` Registers a subcommand with the specified name and all specified aliases.
`static <C extends java.util.concurrent.Callable<T>,T> T` `call(java.lang.Class<C> callableClass, CommandLine.IFactory factory, java.io.PrintStream out, CommandLine.Help.Ansi ansi, java.lang.String... args)` Delegates to `call(Class, IFactory, PrintStream, PrintStream, Help.Ansi, String...)` with `System.err` for diagnostic error messages.
`static <C extends java.util.concurrent.Callable<T>,T> T` `call(java.lang.Class<C> callableClass, CommandLine.IFactory factory, java.io.PrintStream out, java.io.PrintStream err, CommandLine.Help.Ansi ansi, java.lang.String... args)` Convenience method to allow command line application authors to avoid some boilerplate code in their application.
`static <C extends java.util.concurrent.Callable<T>,T> T` `call(java.lang.Class<C> callableClass, CommandLine.IFactory factory, java.io.PrintStream out, java.lang.String... args)` Delegates to `call(Class, IFactory, PrintStream, PrintStream, Help.Ansi, String...)` with `System.err` for diagnostic error messages, and `CommandLine.Help.Ansi.AUTO`.
`static <C extends java.util.concurrent.Callable<T>,T> T` `call(java.lang.Class<C> callableClass, CommandLine.IFactory factory, java.lang.String... args)` Delegates to `call(Class, IFactory, PrintStream, PrintStream, Help.Ansi, String...)` with `System.out` for requested usage help messages, `System.err` for diagnostic error messages, and `CommandLine.Help.Ansi.AUTO`.
`static <C extends java.util.concurrent.Callable<T>,T> T` `call(C callable, java.io.PrintStream out, CommandLine.Help.Ansi ansi, java.lang.String... args)` Delegates to `call(Callable, PrintStream, PrintStream, Help.Ansi, String...)` with `System.err` for diagnostic error messages.
`static <C extends java.util.concurrent.Callable<T>,T> T` `call(C callable, java.io.PrintStream out, java.io.PrintStream err, CommandLine.Help.Ansi ansi, java.lang.String... args)` Convenience method to allow command line application authors to avoid some boilerplate code in their application.
`static <C extends java.util.concurrent.Callable<T>,T> T` `call(C callable, java.io.PrintStream out, java.lang.String... args)` Delegates to `call(Callable, PrintStream, PrintStream, Help.Ansi, String...)` with `System.err` for diagnostic error messages and `CommandLine.Help.Ansi.AUTO`.
`static <C extends java.util.concurrent.Callable<T>,T> T` `call(C callable, java.lang.String... args)` Delegates to `call(Callable, PrintStream, PrintStream, Help.Ansi, String...)` with `System.out` for requested usage help messages, `System.err` for diagnostic error messages, and `CommandLine.Help.Ansi.AUTO`.
`static CommandLine.DefaultExceptionHandler<java.util.List<java.lang.Object>>` `defaultExceptionHandler()` Convenience method that returns `new DefaultExceptionHandler<List<Object>>()`.
`java.lang.Character` `getAtFileCommentChar()` Returns the character that starts a single-line comment or `null` if all content of argument files should be interpreted as arguments (without comments).
`<T> T` `getCommand()` Returns the annotated user object that this `CommandLine` instance was constructed with.
`static java.util.List<java.lang.reflect.Method>` `getCommandMethods(java.lang.Class<?> cls, java.lang.String methodName)` Helper to get methods of a class annotated with `@Command` via reflection, optionally filtered by method name (not `@Command.name`).
`java.lang.String` `getCommandName()` Returns the command name (also called program name) displayed in the usage help synopsis.
`CommandLine.Model.CommandSpec` `getCommandSpec()` Returns the `CommandSpec` model that this `CommandLine` was constructed with.
`CommandLine.IDefaultValueProvider` `getDefaultValueProvider()` Returns the default value provider for the command, or `null` if none has been set.
`java.lang.String` `getEndOfOptionsDelimiter()` Returns the end-of-options delimiter that signals that the remaining command line arguments should be treated as positional parameters.
`CommandLine.IHelpFactory` `getHelpFactory()` Returns the `IHelpFactory` that is used to construct the usage help message.
`java.util.List<java.lang.String>` `getHelpSectionKeys()` Returns the section keys in the order that the usage help message should render the sections.
`java.util.Map<java.lang.String,CommandLine.IHelpSectionRenderer>` `getHelpSectionMap()` Returns the map of section keys and renderers used to construct the usage help message.
`java.util.Map<java.lang.String,java.lang.Object>` `getMixins()` Returns a map of user objects whose options and positional parameters were added to ("mixed in" with) this command.
`CommandLine` `getParent()` Returns the command that this is a subcommand of, or `null` if this is a top-level command.
`CommandLine.ParseResult` `getParseResult()`
`java.util.ResourceBundle` `getResourceBundle()` Returns the ResourceBundle of this command or `null` if no resource bundle is set.
`java.lang.String` `getSeparator()` Returns the String that separates option names from option values when parsing command line options.
`java.util.Map<java.lang.String,CommandLine>` `getSubcommands()` Returns a map with the subcommands registered on this instance.
`java.util.List<java.lang.String>` `getUnmatchedArguments()` Returns the list of unmatched command line arguments, if any.
`int` `getUsageHelpWidth()` Returns the maximum width of the usage help message.
`java.lang.String` `getUsageMessage()` Similar to `usage(PrintStream)`, but returns the usage help message as a String instead of printing it to the `PrintStream`.
`java.lang.String` `getUsageMessage(CommandLine.Help.Ansi ansi)` Similar to `usage(PrintStream, Help.Ansi)`, but returns the usage help message as a String instead of printing it to the `PrintStream`.
`java.lang.String` `getUsageMessage(CommandLine.Help.ColorScheme colorScheme)` Similar to `usage(PrintStream, Help.ColorScheme)`, but returns the usage help message as a String instead of printing it to the `PrintStream`.
`static java.lang.Object` `invoke(java.lang.String methodName, java.lang.Class<?> cls, java.io.PrintStream out, CommandLine.Help.Ansi ansi, java.lang.String... args)` Delegates to `invoke(String, Class, PrintStream, PrintStream, Help.Ansi, String...)` with the specified stream for requested usage help messages, `System.err` for diagnostic error messages, and the specified Ansi mode.
`static java.lang.Object` `invoke(java.lang.String methodName, java.lang.Class<?> cls, java.io.PrintStream out, java.io.PrintStream err, CommandLine.Help.Ansi ansi, java.lang.String... args)` Convenience method to allow command line application authors to avoid some boilerplate code in their application.
`static java.lang.Object` `invoke(java.lang.String methodName, java.lang.Class<?> cls, java.io.PrintStream out, java.lang.String... args)` Delegates to `invoke(String, Class, PrintStream, PrintStream, Help.Ansi, String...)` with the specified stream for requested usage help messages, `System.err` for diagnostic error messages, and `CommandLine.Help.Ansi.AUTO`.
`static java.lang.Object` `invoke(java.lang.String methodName, java.lang.Class<?> cls, java.lang.String... args)` Delegates to `invoke(String, Class, PrintStream, PrintStream, Help.Ansi, String...)` with `System.out` for requested usage help messages, `System.err` for diagnostic error messages, and `CommandLine.Help.Ansi.AUTO`.
`boolean` `isCaseInsensitiveEnumValuesAllowed()` Returns whether the parser should ignore case when converting arguments to `enum` values.
`boolean` `isExpandAtFiles()` Returns 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.
`boolean` `isOverwrittenOptionsAllowed()` Returns whether options for single-value fields can be specified multiple times on the command line.
`boolean` `isPosixClusteredShortOptionsAllowed()` Returns whether the parser accepts clustered short options.
`boolean` `isSplitQuotedStrings()` Returns whether the parser is allowed to split quoted Strings or not.
`boolean` `isStopAtPositional()` Returns whether the parser interprets the first positional parameter as "end of options" so the remaining arguments are all treated as positional parameters.
`boolean` `isStopAtUnmatched()` Returns whether the parser should stop interpreting options and positional parameters as soon as it encounters an unmatched option.
`boolean` `isToggleBooleanFlags()` Returns whether the value of boolean flag options should be "toggled" when the option is matched.
`boolean` `isTrimQuotes()` Returns whether the parser should trim quotes from command line arguments before processing them.
`boolean` `isUnmatchedArgumentsAllowed()` Returns whether the end user may specify arguments on the command line that are not matched to any option or parameter fields.
`boolean` `isUnmatchedOptionsArePositionalParams()` Returns whether arguments on the command line that resemble an option should be treated as positional parameters.
`boolean` `isUsageHelpRequested()` Returns `true` if an option annotated with `CommandLine.Option.usageHelp()` was specified on the command line.
`boolean` `isUseSimplifiedAtFiles()` Returns whether to use a simplified argument file format that is compatible with JCommander.
`boolean` `isVersionHelpRequested()` Returns `true` if an option annotated with `CommandLine.Option.versionHelp()` was specified on the command line.
`java.util.List<CommandLine>` `parse(java.lang.String... args)` Parses the specified command line arguments and returns a list of `CommandLine` objects representing the top-level command and any subcommands (if any) that were recognized and initialized during the parsing process.
`CommandLine.ParseResult` `parseArgs(java.lang.String... args)` Parses the specified command line arguments and returns a list of `ParseResult` with the options, positional parameters, and subcommands (if any) that were recognized and initialized during the parsing process.
`<R> R` `parseWithHandler(CommandLine.IParseResultHandler2<R> handler, java.lang.String[] args)` Returns the result of calling `parseWithHandlers(IParseResultHandler2, IExceptionHandler2, String...)` with a new `CommandLine.DefaultExceptionHandler` in addition to the specified parse result handler and the specified command line arguments.
`java.util.List<java.lang.Object>` `parseWithHandler(CommandLine.IParseResultHandler handler, java.io.PrintStream out, java.lang.String... args)` Deprecated. use `parseWithHandler(IParseResultHandler2, String[])` instead
`<R> R` `parseWithHandlers(CommandLine.IParseResultHandler2<R> handler, CommandLine.IExceptionHandler2<R> exceptionHandler, java.lang.String... args)` Tries to parse the specified command line arguments, and if successful, delegates the processing of the resulting `ParseResult` object to the specified handler.
`java.util.List<java.lang.Object>` `parseWithHandlers(CommandLine.IParseResultHandler handler, java.io.PrintStream out, CommandLine.Help.Ansi ansi, CommandLine.IExceptionHandler exceptionHandler, java.lang.String... args)` Deprecated. use `parseWithHandlers(IParseResultHandler2, IExceptionHandler2, String...)` instead
`static <T> T` `populateCommand(T command, java.lang.String... args)` Convenience method that initializes the specified annotated object from the specified command line arguments.
`static <T> T` `populateSpec(java.lang.Class<T> spec, java.lang.String... args)` Convenience method that derives the command specification from the specified interface class, and returns an instance of the specified interface.
`static boolean` `printHelpIfRequested(CommandLine.ParseResult parseResult)` Delegates to `printHelpIfRequested(List, PrintStream, PrintStream, Help.Ansi)` with `parseResult.asCommandLineList(), System.out, System.err, Help.Ansi.AUTO`.
`static boolean` `printHelpIfRequested(java.util.List<CommandLine> parsedCommands, java.io.PrintStream out, CommandLine.Help.Ansi ansi)` Deprecated. use `printHelpIfRequested(List, PrintStream, PrintStream, Help.Ansi)` instead
`static boolean` `printHelpIfRequested(java.util.List<CommandLine> parsedCommands, java.io.PrintStream out, java.io.PrintStream err, CommandLine.Help.Ansi ansi)` Helper method that may be useful when processing the list of `CommandLine` objects that result from successfully parsing command line arguments.
`static boolean` `printHelpIfRequested(java.util.List<CommandLine> parsedCommands, java.io.PrintStream out, java.io.PrintStream err, CommandLine.Help.ColorScheme colorScheme)` Helper method that may be useful when processing the list of `CommandLine` objects that result from successfully parsing command line arguments.
`void` `printVersionHelp(java.io.PrintStream out)` Delegates to `printVersionHelp(PrintStream, Help.Ansi)` with the platform default.
`void` `printVersionHelp(java.io.PrintStream out, CommandLine.Help.Ansi ansi)` Prints version information from the `CommandLine.Command.version()` annotation to the specified `PrintStream`.
`void` `printVersionHelp(java.io.PrintStream out, CommandLine.Help.Ansi ansi, java.lang.Object... params)` Prints version information from the `CommandLine.Command.version()` annotation to the specified `PrintStream`.
`<K> CommandLine` `registerConverter(java.lang.Class<K> cls, CommandLine.ITypeConverter<K> converter)` Registers the specified type converter for the specified class.
`static <R extends java.lang.Runnable> void` `run(java.lang.Class<R> runnableClass, CommandLine.IFactory factory, java.io.PrintStream out, CommandLine.Help.Ansi ansi, java.lang.String... args)` Delegates to `run(Class, IFactory, PrintStream, PrintStream, Help.Ansi, String...)` with `System.err` for diagnostic error messages.
`static <R extends java.lang.Runnable> void` `run(java.lang.Class<R> runnableClass, CommandLine.IFactory factory, java.io.PrintStream out, java.io.PrintStream err, CommandLine.Help.Ansi ansi, java.lang.String... args)` Convenience method to allow command line application authors to avoid some boilerplate code in their application.
`static <R extends java.lang.Runnable> void` `run(java.lang.Class<R> runnableClass, CommandLine.IFactory factory, java.io.PrintStream out, java.lang.String... args)` Delegates to `run(Class, IFactory, PrintStream, PrintStream, Help.Ansi, String...)` with `System.err` for diagnostic error messages, and `CommandLine.Help.Ansi.AUTO`.
`static <R extends java.lang.Runnable> void` `run(java.lang.Class<R> runnableClass, CommandLine.IFactory factory, java.lang.String... args)` Delegates to `run(Class, IFactory, PrintStream, PrintStream, Help.Ansi, String...)` with `System.out` for requested usage help messages, `System.err` for diagnostic error messages, and `CommandLine.Help.Ansi.AUTO`.
`static <R extends java.lang.Runnable> void` `run(R runnable, java.io.PrintStream out, CommandLine.Help.Ansi ansi, java.lang.String... args)` Delegates to `run(Runnable, PrintStream, PrintStream, Help.Ansi, String...)` with `System.err` for diagnostic error messages.
`static <R extends java.lang.Runnable> void` `run(R runnable, java.io.PrintStream out, java.io.PrintStream err, CommandLine.Help.Ansi ansi, java.lang.String... args)` Convenience method to allow command line application authors to avoid some boilerplate code in their application.
`static <R extends java.lang.Runnable> void` `run(R runnable, java.io.PrintStream out, java.lang.String... args)` Delegates to `run(Runnable, PrintStream, PrintStream, Help.Ansi, String...)` with `System.err` for diagnostic error messages and `CommandLine.Help.Ansi.AUTO`.
`static <R extends java.lang.Runnable> void` `run(R runnable, java.lang.String... args)` Delegates to `run(Runnable, PrintStream, PrintStream, Help.Ansi, String...)` with `System.out` for requested usage help messages, `System.err` for diagnostic error messages, and `CommandLine.Help.Ansi.AUTO`.
`CommandLine` `setAtFileCommentChar(java.lang.Character atFileCommentChar)` Sets the character that starts a single-line comment or `null` 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 to `enum` values.
`CommandLine` `setCommandName(java.lang.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-commands
`CommandLine` `setEndOfOptionsDelimiter(java.lang.String delimiter)` Sets the end-of-options delimiter that signals that the remaining command line arguments should be treated as positional parameters.
`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 new `IHelpFactory` to customize the usage help message.
`CommandLine` `setHelpSectionKeys(java.util.List<java.lang.String> keys)` Sets the section keys in the order that the usage help message should render the sections.
`CommandLine` `setHelpSectionMap(java.util.Map<java.lang.String,CommandLine.IHelpSectionRenderer> map)` Sets the map of section keys and renderers used to construct the usage help message.
`CommandLine` `setOverwrittenOptionsAllowed(boolean newValue)` Sets whether options for single-value fields can be specified multiple times on the command line without a `CommandLine.OverwrittenOptionException` being thrown.
`CommandLine` `setPosixClusteredShortOptionsAllowed(boolean newValue)` Sets whether short options like `-x -v -f SomeFile` can be clustered together like `-xvfSomeFile`.
`CommandLine` `setResourceBundle(java.util.ResourceBundle bundle)` Sets the ResourceBundle containing usage help message strings.
`CommandLine` `setSeparator(java.lang.String separator)` Sets the String the parser uses to separate option names from option values to the specified value.
`CommandLine` `setSplitQuotedStrings(boolean newValue)` Sets whether the parser is allowed to split quoted Strings.
`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` `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 a `CommandLine.UnmatchedArgumentException` being thrown.
`CommandLine` `setUnmatchedOptionsArePositionalParams(boolean newValue)` Sets whether arguments on the command line that resemble an option should be treated as positional parameters.
`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.
`static void` `usage(java.lang.Object command, java.io.PrintStream out)` Equivalent to `new CommandLine(command).usage(out)`.
`static void` `usage(java.lang.Object command, java.io.PrintStream out, CommandLine.Help.Ansi ansi)` Equivalent to `new CommandLine(command).usage(out, ansi)`.
`static void` `usage(java.lang.Object command, java.io.PrintStream out, CommandLine.Help.ColorScheme colorScheme)` Equivalent to `new CommandLine(command).usage(out, colorScheme)`.
`void` `usage(java.io.PrintStream out)` Delegates to `usage(PrintStream, Help.Ansi)` with the platform default.
`void` `usage(java.io.PrintStream out, CommandLine.Help.Ansi ansi)` Delegates to `usage(PrintStream, Help.ColorScheme)` with the default color scheme.
`void` `usage(java.io.PrintStream out, CommandLine.Help.ColorScheme colorScheme)` Prints a usage help message for the annotated command class to the specified `PrintStream`.
`void` `usage(java.io.PrintWriter writer)` Delegates to `usage(PrintWriter, Help.Ansi)` with the platform default.
`void` `usage(java.io.PrintWriter writer, CommandLine.Help.Ansi ansi)` Similar to `usage(PrintStream, Help.Ansi)` but with the specified `PrintWriter` instead of a `PrintStream`.
`void` `usage(java.io.PrintWriter writer, CommandLine.Help.ColorScheme colorScheme)` Similar to `usage(PrintStream, Help.ColorScheme)`, but with the specified `PrintWriter` instead of a `PrintStream`.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Field Detail

#### VERSION

    public static final java.lang.String VERSION

This is picocli version "3.9.6".

See Also:
  Constant Field Values

### Constructor Detail

#### CommandLine

    public CommandLine(java.lang.Object command)

Constructs a new `CommandLine` interpreter with the specified object (which may be an annotated user object or a `CommandSpec`) and a default subcommand factory.

The specified object may be a `CommandSpec` object, or it may be a `@Command`-annotated user object with `@Option` and `@Parameters`-annotated fields, in which case picocli automatically constructs a `CommandSpec` from this user object.

When the `parse(String...)` method is called, the `CommandSpec` object will be initialized based on command line arguments. If the commandSpec is created from an annotated user object, this user object will be initialized based on the command line arguments.

Parameters:
  `command` - an annotated user object or a `CommandSpec` object to initialize from the command line arguments
Throws:
  `CommandLine.InitializationException` - if the specified command object does not have a `CommandLine.Command`, `CommandLine.Option` or `CommandLine.Parameters` annotation

#### CommandLine

    public CommandLine(java.lang.Object command,
                       CommandLine.IFactory factory)

Constructs a new `CommandLine` interpreter with the specified object (which may be an annotated user object or a `CommandSpec`) and object factory.

The specified object may be a `CommandSpec` object, or it may be a `@Command`-annotated user object with `@Option` and `@Parameters`-annotated fields, in which case picocli automatically constructs a `CommandSpec` from this user object.

If the specified command object is an interface `Class` with `@Option` and `@Parameters`-annotated methods, picocli creates a `Proxy` whose methods return the matched command line values. If the specified command object is a concrete `Class`, picocli delegates to the factory to get an instance.

When the `parse(String...)` method is called, the `CommandSpec` object will be initialized based on command line arguments. If the commandSpec is created from an annotated user object, this user object will be initialized based on the command line arguments.

Parameters:
  `command` - an annotated user object or a `CommandSpec` object to initialize from the command line arguments
  `factory` - the factory used to create instances of subcommands, converters, etc., that are registered declaratively with annotation attributes
Throws:
  `CommandLine.InitializationException` - if the specified command object does not have a `CommandLine.Command`, `CommandLine.Option` or `CommandLine.Parameters` annotation
Since:
  2.2

### Method Detail

#### getCommandSpec

    public CommandLine.Model.CommandSpec getCommandSpec()

Returns the `CommandSpec` model that this `CommandLine` was constructed with.

Returns:
  the `CommandSpec` model
Since:
  3.0

#### addMixin

    public CommandLine addMixin(java.lang.String name,
                                java.lang.Object mixin)

Adds the options and positional parameters in the specified mixin to this command.

The specified object may be a `CommandSpec` object, or it may be a user object with `@Option` and `@Parameters`-annotated fields, in which case picocli automatically constructs a `CommandSpec` from this user object.

Parameters:
  `name` - the name by which the mixin object may later be retrieved
  `mixin` - an annotated user object or a `CommandSpec` object whose options and positional parameters to add to this command
Returns:
  this CommandLine object, to allow method chaining
Since:
  3.0

#### getMixins

    public java.util.Map<java.lang.String,java.lang.Object> getMixins()

Returns a map of user objects whose options and positional parameters were added to ("mixed in" with) this command.

Returns:
  a new Map containing the user objects mixed in with this command. If `CommandSpec` objects without user objects were programmatically added, use the `underlying model` directly.
Since:
  3.0

#### addSubcommand

    public CommandLine addSubcommand(java.lang.String name,
                                     java.lang.Object command)

Registers a subcommand with the specified name. For example:

     CommandLine commandLine = new CommandLine(new Git())
             .addSubcommand("status",   new GitStatus())
             .addSubcommand("commit",   new GitCommit();
             .addSubcommand("add",      new GitAdd())
             .addSubcommand("branch",   new GitBranch())
             .addSubcommand("checkout", new GitCheckout())
             //...
             ;

The specified object can be an annotated object or a `CommandLine` instance with its own nested subcommands. For example:

     CommandLine commandLine = new CommandLine(new MainCommand())
             .addSubcommand("cmd1",                 new ChildCommand1()) // subcommand
             .addSubcommand("cmd2",                 new ChildCommand2())
             .addSubcommand("cmd3", new CommandLine(new ChildCommand3()) // subcommand with nested sub-subcommands
                     .addSubcommand("cmd3sub1",                 new GrandChild3Command1())
                     .addSubcommand("cmd3sub2",                 new GrandChild3Command2())
                     .addSubcommand("cmd3sub3", new CommandLine(new GrandChild3Command3()) // deeper nesting
                             .addSubcommand("cmd3sub3sub1", new GreatGrandChild3Command3_1())
                             .addSubcommand("cmd3sub3sub2", new GreatGrandChild3Command3_2())
                     )
             );

The default type converters are available on all subcommands and nested sub-subcommands, but custom type converters are registered only with the subcommand hierarchy as it existed when the custom type was registered. To ensure a custom type converter is available to all subcommands, register the type converter last, after adding subcommands.

See also the `CommandLine.Command.subcommands()` annotation to register subcommands declaratively.

Parameters:
  `name` - the string to recognize on the command line as a subcommand
  `command` - the object to initialize with command line arguments following the subcommand name. This may be a `CommandLine` instance with its own (nested) subcommands
Returns:
  this CommandLine object, to allow method chaining
Since:
  0.9.7
See Also:
  `registerConverter(Class, ITypeConverter)`, `CommandLine.Command.subcommands()`

#### addSubcommand

    public CommandLine addSubcommand(java.lang.String name,
                                     java.lang.Object command,
                                     java.lang.String... aliases)

Registers a subcommand with the specified name and all specified aliases. See also `addSubcommand(String, Object)`.

Parameters:
  `name` - the string to recognize on the command line as a subcommand
  `command` - the object to initialize with command line arguments following the subcommand name. This may be a `CommandLine` instance with its own (nested) subcommands
  `aliases` - zero or more alias names that are also recognized on the command line as this subcommand
Returns:
  this CommandLine object, to allow method chaining
Since:
  3.1
See Also:
  `addSubcommand(String, Object)`

#### getSubcommands

    public java.util.Map<java.lang.String,CommandLine> getSubcommands()

Returns a map with the subcommands registered on this instance.

Returns:
  a map with the registered subcommands
Since:
  0.9.7

#### getParent

    public CommandLine getParent()

Returns the command that this is a subcommand of, or `null` if this is a top-level command.

Returns:
  the command that this is a subcommand of, or `null` if this is a top-level command
Since:
  0.9.8
See Also:
  `addSubcommand(String, Object)`, `CommandLine.Command.subcommands()`

#### getCommand

    public <T> T getCommand()

Returns the annotated user object that this `CommandLine` instance was constructed with.

Type Parameters:
  `T` - the type of the variable that the return value is being assigned to
Returns:
  the annotated object that this `CommandLine` instance was constructed with
Since:
  0.9.7

#### isUsageHelpRequested

    public boolean isUsageHelpRequested()

Returns `true` if an option annotated with `CommandLine.Option.usageHelp()` was specified on the command line.

Returns:
  whether the parser encountered an option annotated with `CommandLine.Option.usageHelp()`.
Since:
  0.9.8

#### isVersionHelpRequested

    public boolean isVersionHelpRequested()

Returns `true` if an option annotated with `CommandLine.Option.versionHelp()` was specified on the command line.

Returns:
  whether the parser encountered an option annotated with `CommandLine.Option.versionHelp()`.
Since:
  0.9.8

#### getHelpFactory

    public CommandLine.IHelpFactory getHelpFactory()

Returns the `IHelpFactory` that is used to construct the usage help message.

Since:
  3.9
See Also:
  `setHelpFactory(IHelpFactory)`

#### setHelpFactory

    public CommandLine setHelpFactory(CommandLine.IHelpFactory helpFactory)

Sets a new `IHelpFactory` to customize the usage help message.

Parameters:
  `helpFactory` - the new help factory. Must be non-`null`.

  The specified setting will be registered with this `CommandLine` and the full hierarchy of its subcommands and nested sub-subcommands at the moment this method is called. Subcommands added later will have the default setting. To ensure a setting is applied to all subcommands, call the setter last, after adding subcommands.

Returns:
  this `CommandLine` object, to allow method chaining
Since:
  3.9

#### getHelpSectionKeys

    public java.util.List<java.lang.String> getHelpSectionKeys()

Returns the section keys in the order that the usage help message should render the sections. This ordering may be modified with `setSectionKeys`. The default keys are (in order):

1. `SECTION_KEY_HEADER_HEADING`
2. `SECTION_KEY_HEADER`
3. `SECTION_KEY_SYNOPSIS_HEADING`
4. `SECTION_KEY_SYNOPSIS`
5. `SECTION_KEY_DESCRIPTION_HEADING`
6. `SECTION_KEY_DESCRIPTION`
7. `SECTION_KEY_PARAMETER_LIST_HEADING`
8. `SECTION_KEY_PARAMETER_LIST`
9. `SECTION_KEY_OPTION_LIST_HEADING`
10. `SECTION_KEY_OPTION_LIST`
11. `SECTION_KEY_COMMAND_LIST_HEADING`
12. `SECTION_KEY_COMMAND_LIST`
13. `SECTION_KEY_FOOTER_HEADING`
14. `SECTION_KEY_FOOTER`

Since:
  3.9

#### setHelpSectionKeys

    public CommandLine setHelpSectionKeys(java.util.List<java.lang.String> keys)

Sets the section keys in the order that the usage help message should render the sections.

The specified setting will be registered with this `CommandLine` and the full hierarchy of its subcommands and nested sub-subcommands at the moment this method is called. Subcommands added later will have the default setting. To ensure a setting is applied to all subcommands, call the setter last, after adding subcommands.

Use `CommandLine.Model.UsageMessageSpec.sectionKeys(List)` to customize a command without affecting its subcommands.

Since:
  3.9
See Also:
  `getHelpSectionKeys()`

#### getHelpSectionMap

    public java.util.Map<java.lang.String,CommandLine.IHelpSectionRenderer> getHelpSectionMap()

Returns the map of section keys and renderers used to construct the usage help message. The usage help message can be customized by adding, replacing and removing section renderers from this map. Sections can be reordered with `setSectionKeys`. Sections that are either not in this map or not in the list returned by `getSectionKeys` are omitted.

NOTE: By modifying the returned `Map`, only the usage help message of this command is affected. Use `setHelpSectionMap(Map)` to customize the usage help message for this command and all subcommands.

Since:
  3.9

#### setHelpSectionMap

    public CommandLine setHelpSectionMap(java.util.Map<java.lang.String,CommandLine.IHelpSectionRenderer> map)

Sets the map of section keys and renderers used to construct the usage help message.

The specified setting will be registered with this `CommandLine` and the full hierarchy of its subcommands and nested sub-subcommands at the moment this method is called. Subcommands added later will have the default setting. To ensure a setting is applied to all subcommands, call the setter last, after adding subcommands.

Use `CommandLine.Model.UsageMessageSpec.sectionMap(Map)` to customize a command without affecting its subcommands.

Since:
  3.9
See Also:
  `getHelpSectionMap()`

#### isToggleBooleanFlags

    public boolean isToggleBooleanFlags()

Returns whether the value of boolean flag options should be "toggled" when the option is matched. By default, flags are toggled, so if the value is `true` it is set to `false`, and when the value is `false` it is set to `true`. If toggling is off, flags are simply set to `true`.

Returns:
  `true` the value of boolean flag options should be "toggled" when the option is matched, `false` otherwise
Since:
  3.0

#### setToggleBooleanFlags

    public CommandLine setToggleBooleanFlags(boolean newValue)

Sets whether the value of boolean flag options should be "toggled" when the option is matched. The default is `true`.

The specified setting will be registered with this `CommandLine` and the full hierarchy of its subcommands and nested sub-subcommands at the moment this method is called. Subcommands added later will have the default setting. To ensure a setting is applied to all subcommands, call the setter last, after adding subcommands.

Parameters:
  `newValue` - the new setting
Returns:
  this `CommandLine` object, to allow method chaining
Since:
  3.0

#### isOverwrittenOptionsAllowed

    public boolean isOverwrittenOptionsAllowed()

Returns whether options for single-value fields can be specified multiple times on the command line. The default is `false` and a `CommandLine.OverwrittenOptionException` is thrown if this happens. When `true`, the last specified value is retained.

Returns:
  `true` if options for single-value fields can be specified multiple times on the command line, `false` otherwise
Since:
  0.9.7

#### setOverwrittenOptionsAllowed

    public CommandLine setOverwrittenOptionsAllowed(boolean newValue)

Sets whether options for single-value fields can be specified multiple times on the command line without a `CommandLine.OverwrittenOptionException` being thrown. The default is `false`.

The specified setting will be registered with this `CommandLine` and the full hierarchy of its subcommands and nested sub-subcommands at the moment this method is called. Subcommands added later will have the default setting. To ensure a setting is applied to all subcommands, call the setter last, after adding subcommands.

Parameters:
  `newValue` - the new setting
Returns:
  this `CommandLine` object, to allow method chaining
Since:
  0.9.7

#### isPosixClusteredShortOptionsAllowed

    public boolean isPosixClusteredShortOptionsAllowed()

Returns whether the parser accepts clustered short options. The default is `true`.

Returns:
  `true` if short options like `-x -v -f SomeFile` can be clustered together like `-xvfSomeFile`, `false` otherwise
Since:
  3.0

#### setPosixClusteredShortOptionsAllowed

    public CommandLine setPosixClusteredShortOptionsAllowed(boolean newValue)

Sets whether short options like `-x -v -f SomeFile` can be clustered together like `-xvfSomeFile`. The default is `true`.

The specified setting will be registered with this `CommandLine` and the full hierarchy of its subcommands and nested sub-subcommands at the moment this method is called. Subcommands added later will have the default setting. To ensure a setting is applied to all subcommands, call the setter last, after adding subcommands.

Parameters:
  `newValue` - the new setting
Returns:
  this `CommandLine` object, to allow method chaining
Since:
  3.0

#### isCaseInsensitiveEnumValuesAllowed

    public boolean isCaseInsensitiveEnumValuesAllowed()

Returns whether the parser should ignore case when converting arguments to `enum` values. The default is `false`.

Returns:
  `true` if enum values can be specified that don't match the `toString()` value of the enum constant, `false` otherwise; e.g., for an option of type java.time.DayOfWeek, values `MonDaY`, `monday` and `MONDAY` are all recognized if `true`.
Since:
  3.4

#### setCaseInsensitiveEnumValuesAllowed

    public CommandLine setCaseInsensitiveEnumValuesAllowed(boolean newValue)

Sets whether the parser should ignore case when converting arguments to `enum` values. The default is `false`. When set to true, for example, for an option of type java.time.DayOfWeek, values `MonDaY`, `monday` and `MONDAY` are all recognized if `true`.

The specified setting will be registered with this `CommandLine` and the full hierarchy of its subcommands and nested sub-subcommands at the moment this method is called. Subcommands added later will have the default setting. To ensure a setting is applied to all subcommands, call the setter last, after adding subcommands.

Parameters:
  `newValue` - the new setting
Returns:
  this `CommandLine` object, to allow method chaining
Since:
  3.4

#### isTrimQuotes

    public boolean isTrimQuotes()

Returns whether the parser should trim quotes from command line arguments before processing them. The default is read from the system property "picocli.trimQuotes" and will be `true` if the property is present and empty, or if its value is "true".

Returns:
  `true` if the parser should trim quotes from command line arguments before processing them, `false` otherwise;
Since:
  3.7

#### setTrimQuotes

    public CommandLine setTrimQuotes(boolean newValue)

Sets whether the parser should trim quotes from command line arguments before processing them. The default is read from the system property "picocli.trimQuotes" and will be `true` if the property is set and empty, or if its value is "true".

The specified setting will be registered with this `CommandLine` and the full hierarchy of its subcommands and nested sub-subcommands at the moment this method is called. Subcommands added later will have the default setting. To ensure a setting is applied to all subcommands, call the setter last, after adding subcommands.

Calling this method will cause the "picocli.trimQuotes" property to have no effect.

Parameters:
  `newValue` - the new setting
Returns:
  this `CommandLine` object, to allow method chaining
Since:
  3.7

#### isSplitQuotedStrings

    public boolean isSplitQuotedStrings()

Returns whether the parser is allowed to split quoted Strings or not. The default is `false`, so quoted strings are treated as a single value that cannot be split.

Returns:
  `true` if the parser is allowed to split quoted Strings, `false` otherwise;
Since:
  3.7
See Also:
  `CommandLine.Model.ArgSpec.splitRegex()`

#### setSplitQuotedStrings

    public CommandLine setSplitQuotedStrings(boolean newValue)

Sets whether the parser is allowed to split quoted Strings. The default is `false`.

The specified setting will be registered with this `CommandLine` and the full hierarchy of its subcommands and nested sub-subcommands at the moment this method is called. Subcommands added later will have the default setting. To ensure a setting is applied to all subcommands, call the setter last, after adding subcommands.

Parameters:
  `newValue` - the new setting
Returns:
  this `CommandLine` object, to allow method chaining
Since:
  3.7
See Also:
  `CommandLine.Model.ArgSpec.splitRegex()`

#### getEndOfOptionsDelimiter

    public java.lang.String getEndOfOptionsDelimiter()

Returns the end-of-options delimiter that signals that the remaining command line arguments should be treated as positional parameters.

Returns:
  the end-of-options delimiter. The default is `"--"`.
Since:
  3.5

#### setEndOfOptionsDelimiter

    public CommandLine setEndOfOptionsDelimiter(java.lang.String delimiter)

Sets the end-of-options delimiter that signals that the remaining command line arguments should be treated as positional parameters.

Parameters:
  `delimiter` - the end-of-options delimiter; must not be `null`. The default is `"--"`.
Returns:
  this `CommandLine` object, to allow method chaining
Since:
  3.5

#### getDefaultValueProvider

    public CommandLine.IDefaultValueProvider getDefaultValueProvider()

Returns the default value provider for the command, or `null` if none has been set.

Returns:
  the default value provider for this command, or `null`
Since:
  3.6
See Also:
  `CommandLine.Command.defaultValueProvider()`, `CommandLine.Model.CommandSpec.defaultValueProvider()`, `CommandLine.Model.ArgSpec.defaultValueString()`

#### setDefaultValueProvider

    public CommandLine setDefaultValueProvider(CommandLine.IDefaultValueProvider newValue)

Sets a default value provider for the command and sub-commands

The specified setting will be registered with this `CommandLine` and the full hierarchy of its sub-commands and nested sub-subcommands at the moment this method is called. Sub-commands added later will have the default setting. To ensure a setting is applied to all sub-commands, call the setter last, after adding sub-commands.

Parameters:
  `newValue` - the default value provider to use
Returns:
  this `CommandLine` object, to allow method chaining
Since:
  3.6

#### isStopAtPositional

    public boolean isStopAtPositional()

Returns whether the parser interprets the first positional parameter as "end of options" so the remaining arguments are all treated as positional parameters. The default is `false`.

Returns:
  `true` if all values following the first positional parameter should be treated as positional parameters, `false` otherwise
Since:
  2.3

#### setStopAtPositional

    public 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. The default is `false`.

The specified setting will be registered with this `CommandLine` and the full hierarchy of its subcommands and nested sub-subcommands at the moment this method is called. Subcommands added later will have the default setting. To ensure a setting is applied to all subcommands, call the setter last, after adding subcommands.

Parameters:
  `newValue` - `true` if all values following the first positional parameter should be treated as positional parameters, `false` otherwise
Returns:
  this `CommandLine` object, to allow method chaining
Since:
  2.3

#### isStopAtUnmatched

    public boolean isStopAtUnmatched()

Returns whether the parser should stop interpreting options and positional parameters as soon as it encounters an unmatched option. Unmatched options are arguments that look like an option but are not one of the known options, or positional arguments for which there is no available slots (the command has no positional parameters or their size is limited). The default is `false`.

Setting this flag to `true` automatically sets the unmatchedArgumentsAllowed flag to `true` also.

Returns:
  `true` when an unmatched option should result in the remaining command line arguments to be added to the unmatchedArguments list
Since:
  2.3

#### setStopAtUnmatched

    public CommandLine setStopAtUnmatched(boolean newValue)

Sets whether the parser should stop interpreting options and positional parameters as soon as it encounters an unmatched option. Unmatched options are arguments that look like an option but are not one of the known options, or positional arguments for which there is no available slots (the command has no positional parameters or their size is limited). The default is `false`.

Setting this flag to `true` automatically sets the unmatchedArgumentsAllowed flag to `true` also.

The specified setting will be registered with this `CommandLine` and the full hierarchy of its subcommands and nested sub-subcommands at the moment this method is called. Subcommands added later will have the default setting. To ensure a setting is applied to all subcommands, call the setter last, after adding subcommands.

Parameters:
  `newValue` - `true` when an unmatched option should result in the remaining command line arguments to be added to the unmatchedArguments list
Returns:
  this `CommandLine` object, to allow method chaining
Since:
  2.3

#### isUnmatchedOptionsArePositionalParams

    public boolean isUnmatchedOptionsArePositionalParams()

Returns whether arguments on the command line that resemble an option should be treated as positional parameters. The default is `false` and the parser behaviour depends on `isUnmatchedArgumentsAllowed()`.

Returns:
  `true` arguments on the command line that resemble an option should be treated as positional parameters, `false` otherwise
Since:
  3.0
See Also:
  `getUnmatchedArguments()`

#### setUnmatchedOptionsArePositionalParams

    public CommandLine setUnmatchedOptionsArePositionalParams(boolean newValue)

Sets whether arguments on the command line that resemble an option should be treated as positional parameters. The default is `false`.

The specified setting will be registered with this `CommandLine` and the full hierarchy of its subcommands and nested sub-subcommands at the moment this method is called. Subcommands added later will have the default setting. To ensure a setting is applied to all subcommands, call the setter last, after adding subcommands.

Parameters:
  `newValue` - the new setting. When `true`, arguments on the command line that resemble an option should be treated as positional parameters.
Returns:
  this `CommandLine` object, to allow method chaining
Since:
  3.0
See Also:
  `getUnmatchedArguments()`, `isUnmatchedArgumentsAllowed()`

#### isUnmatchedArgumentsAllowed

    public boolean isUnmatchedArgumentsAllowed()

Returns whether the end user may specify arguments on the command line that are not matched to any option or parameter fields. The default is `false` and a `CommandLine.UnmatchedArgumentException` is thrown if this happens. When `true`, the last unmatched arguments are available via the `getUnmatchedArguments()` method.

Returns:
  `true` if the end use may specify unmatched arguments on the command line, `false` otherwise
Since:
  0.9.7
See Also:
  `getUnmatchedArguments()`

#### setUnmatchedArgumentsAllowed

    public CommandLine setUnmatchedArgumentsAllowed(boolean newValue)

Sets whether the end user may specify unmatched arguments on the command line without a `CommandLine.UnmatchedArgumentException` being thrown. The default is `false`.

The specified setting will be registered with this `CommandLine` and the full hierarchy of its subcommands and nested sub-subcommands at the moment this method is called. Subcommands added later will have the default setting. To ensure a setting is applied to all subcommands, call the setter last, after adding subcommands.

Parameters:
  `newValue` - the new setting. When `true`, the last unmatched arguments are available via the `getUnmatchedArguments()` method.
Returns:
  this `CommandLine` object, to allow method chaining
Since:
  0.9.7
See Also:
  `getUnmatchedArguments()`

#### getUnmatchedArguments

    public java.util.List<java.lang.String> getUnmatchedArguments()

Returns the list of unmatched command line arguments, if any.

Returns:
  the list of unmatched command line arguments or an empty list
Since:
  0.9.7
See Also:
  `isUnmatchedArgumentsAllowed()`

#### populateCommand

    public static <T> T populateCommand(T command,
                                        java.lang.String... args)

Convenience method that initializes the specified annotated object from the specified command line arguments.

This is equivalent to

     CommandLine cli = new CommandLine(command);
     cli.parse(args);
     return command;

Type Parameters:
  `T` - the type of the annotated object
Parameters:
  `command` - the object to initialize. This object contains fields annotated with `@Option` or `@Parameters`.
  `args` - the command line arguments to parse
Returns:
  the specified annotated object
Throws:
  `CommandLine.InitializationException` - if the specified command object does not have a `CommandLine.Command`, `CommandLine.Option` or `CommandLine.Parameters` annotation
  `CommandLine.ParameterException` - if the specified command line arguments are invalid
Since:
  0.9.7

#### populateSpec

    public static <T> T populateSpec(java.lang.Class<T> spec,
                                     java.lang.String... args)

Convenience method that derives the command specification from the specified interface class, and returns an instance of the specified interface. The interface is expected to have annotated getter methods. Picocli will instantiate the interface and the getter methods will return the option and positional parameter values matched on the command line.

This is equivalent to

     CommandLine cli = new CommandLine(spec);
     cli.parse(args);
     return cli.getCommand();

Type Parameters:
  `T` - the type of the annotated object
Parameters:
  `spec` - the interface that defines the command specification. This object contains getter methods annotated with `@Option` or `@Parameters`.
  `args` - the command line arguments to parse
Returns:
  an instance of the specified annotated interface
Throws:
  `CommandLine.InitializationException` - if the specified command object does not have a `CommandLine.Command`, `CommandLine.Option` or `CommandLine.Parameters` annotation
  `CommandLine.ParameterException` - if the specified command line arguments are invalid
Since:
  3.1

#### parse

    public java.util.List<CommandLine> parse(java.lang.String... args)

Parses the specified command line arguments and returns a list of `CommandLine` objects representing the top-level command and any subcommands (if any) that were recognized and initialized during the parsing process.

If parsing succeeds, the first element in the returned list is always `this CommandLine` object. The returned list may contain more elements if subcommands were registered and these subcommands were initialized by matching command line arguments. If parsing fails, a `CommandLine.ParameterException` is thrown.

Parameters:
  `args` - the command line arguments to parse
Returns:
  a list with the top-level command and any subcommands initialized by this method
Throws:
  `CommandLine.ParameterException` - if the specified command line arguments are invalid; use `CommandLine.ParameterException.getCommandLine()` to get the command or subcommand whose user input was invalid

#### parseArgs

    public CommandLine.ParseResult parseArgs(java.lang.String... args)

Parses the specified command line arguments and returns a list of `ParseResult` with the options, positional parameters, and subcommands (if any) that were recognized and initialized during the parsing process.

If parsing fails, a `CommandLine.ParameterException` is thrown.

Parameters:
  `args` - the command line arguments to parse
Returns:
  a list with the top-level command and any subcommands initialized by this method
Throws:
  `CommandLine.ParameterException` - if the specified command line arguments are invalid; use `CommandLine.ParameterException.getCommandLine()` to get the command or subcommand whose user input was invalid

#### getParseResult

    public CommandLine.ParseResult getParseResult()

#### defaultExceptionHandler

    public static CommandLine.DefaultExceptionHandler<java.util.List<java.lang.Object>> defaultExceptionHandler()

Convenience method that returns `new DefaultExceptionHandler<List<Object>>()`.

#### printHelpIfRequested

    @Deprecated
    public static boolean printHelpIfRequested(java.util.List<CommandLine> parsedCommands,
                                                            java.io.PrintStream out,
                                                            CommandLine.Help.Ansi ansi)

Deprecated. use `printHelpIfRequested(List, PrintStream, PrintStream, Help.Ansi)` instead

Since:
  2.0

#### printHelpIfRequested

    public static boolean printHelpIfRequested(CommandLine.ParseResult parseResult)

Delegates to `printHelpIfRequested(List, PrintStream, PrintStream, Help.Ansi)` with `parseResult.asCommandLineList(), System.out, System.err, Help.Ansi.AUTO`.

Since:
  3.0

#### printHelpIfRequested

    public static boolean printHelpIfRequested(java.util.List<CommandLine> parsedCommands,
                                               java.io.PrintStream out,
                                               java.io.PrintStream err,
                                               CommandLine.Help.Ansi ansi)

Helper method that may be useful when processing the list of `CommandLine` objects that result from successfully parsing command line arguments. This method prints out usage help if requested or version help if requested and returns `true`. If the command is a `CommandLine.Command.helpCommand()` and `runnable` or `callable`, that command is executed and this method returns `true`. Otherwise, if none of the specified `CommandLine` objects have help requested, this method returns `false`.

Note that this method only looks at the `usageHelp` and `versionHelp` attributes. The `help` attribute is ignored.

Implementation note:

When an error occurs while processing the help request, it is recommended custom Help commands throw a `CommandLine.ParameterException` with a reference to the parent command. This will print the error message and the usage for the parent command, and will use the exit code of the exception handler if one was set.

Parameters:
  `parsedCommands` - the list of `CommandLine` objects to check if help was requested
  `out` - the `PrintStream` to print help to if requested
  `err` - the error string to print diagnostic messages to, in addition to the output from the exception handler
  `ansi` - for printing help messages using ANSI styles and colors
Returns:
  `true` if help was printed, `false` otherwise
Since:
  3.0
See Also:
  `CommandLine.IHelpCommandInitializable`

#### printHelpIfRequested

    public static boolean printHelpIfRequested(java.util.List<CommandLine> parsedCommands,
                                               java.io.PrintStream out,
                                               java.io.PrintStream err,
                                               CommandLine.Help.ColorScheme colorScheme)

Helper method that may be useful when processing the list of `CommandLine` objects that result from successfully parsing command line arguments. This method prints out usage help if requested or version help if requested and returns `true`. If the command is a `CommandLine.Command.helpCommand()` and `runnable` or `callable`, that command is executed and this method returns `true`. Otherwise, if none of the specified `CommandLine` objects have help requested, this method returns `false`.

Note that this method only looks at the `usageHelp` and `versionHelp` attributes. The `help` attribute is ignored.

Implementation note:

When an error occurs while processing the help request, it is recommended custom Help commands throw a `CommandLine.ParameterException` with a reference to the parent command. This will print the error message and the usage for the parent command, and will use the exit code of the exception handler if one was set.

Parameters:
  `parsedCommands` - the list of `CommandLine` objects to check if help was requested
  `out` - the `PrintStream` to print help to if requested
  `err` - the error string to print diagnostic messages to, in addition to the output from the exception handler
  `colorScheme` - for printing help messages using ANSI styles and colors
Returns:
  `true` if help was printed, `false` otherwise
Since:
  3.6
See Also:
  `CommandLine.IHelpCommandInitializable`

#### parseWithHandler

    @Deprecated
    public java.util.List<java.lang.Object> parseWithHandler(CommandLine.IParseResultHandler handler,
                                                                          java.io.PrintStream out,
                                                                          java.lang.String... args)

Deprecated. use `parseWithHandler(IParseResultHandler2, String[])` instead

Since:
  2.0

#### parseWithHandler

    public <R> R parseWithHandler(CommandLine.IParseResultHandler2<R> handler,
                                  java.lang.String[] args)

Returns the result of calling `parseWithHandlers(IParseResultHandler2, IExceptionHandler2, String...)` with a new `CommandLine.DefaultExceptionHandler` in addition to the specified parse result handler and the specified command line arguments.

This is a convenience method intended to offer the same ease of use as the `run` and `call` methods, but with more flexibility and better support for nested subcommands.

Calling this method roughly expands to:

     try {
         ParseResult parseResult = parseArgs(args);
         return handler.handleParseResult(parseResult);
     } catch (ParameterException ex) {
         return new DefaultExceptionHandler<R>().handleParseException(ex, args);
     }

Picocli provides some default handlers that allow you to accomplish some common tasks with very little code. The following handlers are available:

- `CommandLine.RunLast` handler prints help if requested, and otherwise gets the last specified command or subcommand and tries to execute it as a `Runnable` or `Callable`.
- `CommandLine.RunFirst` handler prints help if requested, and otherwise executes the top-level command as a `Runnable` or `Callable`.
- `CommandLine.RunAll` handler prints help if requested, and otherwise executes all recognized commands and subcommands as `Runnable` or `Callable` tasks.
- `CommandLine.DefaultExceptionHandler` prints the error message followed by usage help

Type Parameters:
  `R` - the return type of this handler
Parameters:
  `handler` - the function that will handle the result of successfully parsing the command line arguments
  `args` - the command line arguments
Returns:
  an object resulting from handling the parse result or the exception that occurred while parsing the input
Throws:
  `CommandLine.ExecutionException` - if the command line arguments were parsed successfully but a problem occurred while processing the parse results; use `CommandLine.ExecutionException.getCommandLine()` to get the command or subcommand where processing failed
Since:
  3.0
See Also:
  `CommandLine.RunLast`, `CommandLine.RunAll`

#### parseWithHandlers

    @Deprecated
    public java.util.List<java.lang.Object> parseWithHandlers(CommandLine.IParseResultHandler handler,
                                                                           java.io.PrintStream out,
                                                                           CommandLine.Help.Ansi ansi,
                                                                           CommandLine.IExceptionHandler exceptionHandler,
                                                                           java.lang.String... args)

Deprecated. use `parseWithHandlers(IParseResultHandler2, IExceptionHandler2, String...)` instead

Since:
  2.0

#### parseWithHandlers

    public <R> R parseWithHandlers(CommandLine.IParseResultHandler2<R> handler,
                                   CommandLine.IExceptionHandler2<R> exceptionHandler,
                                   java.lang.String... args)

Tries to parse the specified command line arguments, and if successful, delegates the processing of the resulting `ParseResult` object to the specified handler. If the command line arguments were invalid, the `ParameterException` thrown from the `parse` method is caught and passed to the specified `CommandLine.IExceptionHandler2`.

This is a convenience method intended to offer the same ease of use as the `run` and `call` methods, but with more flexibility and better support for nested subcommands.

Calling this method roughly expands to:

     ParseResult parseResult = null;
     try {
         parseResult = parseArgs(args);
         return handler.handleParseResult(parseResult);
     } catch (ParameterException ex) {
         return exceptionHandler.handleParseException(ex, (String[]) args);
     } catch (ExecutionException ex) {
         return exceptionHandler.handleExecutionException(ex, parseResult);
     }

Picocli provides some default handlers that allow you to accomplish some common tasks with very little code. The following handlers are available:

- `CommandLine.RunLast` handler prints help if requested, and otherwise gets the last specified command or subcommand and tries to execute it as a `Runnable` or `Callable`.
- `CommandLine.RunFirst` handler prints help if requested, and otherwise executes the top-level command as a `Runnable` or `Callable`.
- `CommandLine.RunAll` handler prints help if requested, and otherwise executes all recognized commands and subcommands as `Runnable` or `Callable` tasks.
- `CommandLine.DefaultExceptionHandler` prints the error message followed by usage help

Type Parameters:
  `R` - the return type of the result handler and exception handler
Parameters:
  `handler` - the function that will handle the result of successfully parsing the command line arguments
  `exceptionHandler` - the function that can handle the `ParameterException` thrown when the command line arguments are invalid
  `args` - the command line arguments
Returns:
  an object resulting from handling the parse result or the exception that occurred while parsing the input
Throws:
  `CommandLine.ExecutionException` - if the command line arguments were parsed successfully but a problem occurred while processing the parse result `ParseResult` object; use `CommandLine.ExecutionException.getCommandLine()` to get the command or subcommand where processing failed
Since:
  3.0
See Also:
  `CommandLine.RunLast`, `CommandLine.RunAll`, `CommandLine.DefaultExceptionHandler`

#### usage

    public static void usage(java.lang.Object command,
                             java.io.PrintStream out)

Equivalent to `new CommandLine(command).usage(out)`. See `usage(PrintStream)` for details.

Parameters:
  `command` - the object annotated with `CommandLine.Command`, `CommandLine.Option` and `CommandLine.Parameters`
  `out` - the print stream to print the help message to
Throws:
  `java.lang.IllegalArgumentException` - if the specified command object does not have a `CommandLine.Command`, `CommandLine.Option` or `CommandLine.Parameters` annotation

#### usage

    public static void usage(java.lang.Object command,
                             java.io.PrintStream out,
                             CommandLine.Help.Ansi ansi)

Equivalent to `new CommandLine(command).usage(out, ansi)`. See `usage(PrintStream, Help.Ansi)` for details.

Parameters:
  `command` - the object annotated with `CommandLine.Command`, `CommandLine.Option` and `CommandLine.Parameters`
  `out` - the print stream to print the help message to
  `ansi` - whether the usage message should contain ANSI escape codes or not
Throws:
  `java.lang.IllegalArgumentException` - if the specified command object does not have a `CommandLine.Command`, `CommandLine.Option` or `CommandLine.Parameters` annotation

#### usage

    public static void usage(java.lang.Object command,
                             java.io.PrintStream out,
                             CommandLine.Help.ColorScheme colorScheme)

Equivalent to `new CommandLine(command).usage(out, colorScheme)`. See `usage(PrintStream, Help.ColorScheme)` for details.

Parameters:
  `command` - the object annotated with `CommandLine.Command`, `CommandLine.Option` and `CommandLine.Parameters`
  `out` - the print stream to print the help message to
  `colorScheme` - the `ColorScheme` defining the styles for options, parameters and commands when ANSI is enabled
Throws:
  `java.lang.IllegalArgumentException` - if the specified command object does not have a `CommandLine.Command`, `CommandLine.Option` or `CommandLine.Parameters` annotation

#### usage

    public void usage(java.io.PrintStream out)

Delegates to `usage(PrintStream, Help.Ansi)` with the platform default.

Parameters:
  `out` - the printStream to print to
See Also:
  `usage(PrintStream, Help.ColorScheme)`

#### usage

    public void usage(java.io.PrintWriter writer)

Delegates to `usage(PrintWriter, Help.Ansi)` with the platform default.

Parameters:
  `writer` - the PrintWriter to print to
Since:
  3.0
See Also:
  `usage(PrintWriter, Help.ColorScheme)`

#### usage

    public void usage(java.io.PrintStream out,
                      CommandLine.Help.Ansi ansi)

Delegates to `usage(PrintStream, Help.ColorScheme)` with the default color scheme.

Parameters:
  `out` - the printStream to print to
  `ansi` - whether the usage message should include ANSI escape codes or not
See Also:
  `usage(PrintStream, Help.ColorScheme)`

#### usage

    public void usage(java.io.PrintWriter writer,
                      CommandLine.Help.Ansi ansi)

Similar to `usage(PrintStream, Help.Ansi)` but with the specified `PrintWriter` instead of a `PrintStream`.

Since:
  3.0

#### usage

    public void usage(java.io.PrintStream out,
                      CommandLine.Help.ColorScheme colorScheme)

Prints a usage help message for the annotated command class to the specified `PrintStream`. Delegates construction of the usage help message to the `CommandLine.Help` inner class and is equivalent to:

     Help.ColorScheme colorScheme = Help.defaultColorScheme(Help.Ansi.AUTO);
     Help help = getHelpFactory().create(getCommandSpec(), colorScheme)
     StringBuilder sb = new StringBuilder();
     for (String key : getHelpSectionKeys()) {
         IHelpSectionRenderer renderer = getHelpSectionMap().get(key);
         if (renderer != null) { sb.append(renderer.render(help)); }
     }
     out.print(sb);

Annotate your class with `CommandLine.Command` to control many aspects of the usage help message, including the program name, text of section headings and section contents, and some aspects of the auto-generated sections of the usage help message.

To customize the auto-generated sections of the usage help message, like how option details are displayed, instantiate a `CommandLine.Help` object and use a `CommandLine.Help.TextTable` with more of fewer columns, a custom layout, and/or a custom option renderer for ultimate control over which aspects of an Option or Field are displayed where.

Parameters:
  `out` - the `PrintStream` to print the usage help message to
  `colorScheme` - the `ColorScheme` defining the styles for options, parameters and commands when ANSI is enabled
See Also:
  `CommandLine.Model.UsageMessageSpec`

#### usage

    public void usage(java.io.PrintWriter writer,
                      CommandLine.Help.ColorScheme colorScheme)

Similar to `usage(PrintStream, Help.ColorScheme)`, but with the specified `PrintWriter` instead of a `PrintStream`.

Since:
  3.0

#### getUsageMessage

    public java.lang.String getUsageMessage()

Similar to `usage(PrintStream)`, but returns the usage help message as a String instead of printing it to the `PrintStream`.

Since:
  3.2

#### getUsageMessage

    public java.lang.String getUsageMessage(CommandLine.Help.Ansi ansi)

Similar to `usage(PrintStream, Help.Ansi)`, but returns the usage help message as a String instead of printing it to the `PrintStream`.

Since:
  3.2

#### getUsageMessage

    public java.lang.String getUsageMessage(CommandLine.Help.ColorScheme colorScheme)

Similar to `usage(PrintStream, Help.ColorScheme)`, but returns the usage help message as a String instead of printing it to the `PrintStream`.

Since:
  3.2

#### printVersionHelp

    public void printVersionHelp(java.io.PrintStream out)

Delegates to `printVersionHelp(PrintStream, Help.Ansi)` with the platform default.

Parameters:
  `out` - the printStream to print to
Since:
  0.9.8
See Also:
  `printVersionHelp(PrintStream, Help.Ansi)`

#### printVersionHelp

    public void printVersionHelp(java.io.PrintStream out,
                                 CommandLine.Help.Ansi ansi)

Prints version information from the `CommandLine.Command.version()` annotation to the specified `PrintStream`. Each element of the array of version strings is printed on a separate line. Version strings may contain markup for colors and style.

Parameters:
  `out` - the printStream to print to
  `ansi` - whether the usage message should include ANSI escape codes or not
Since:
  0.9.8
See Also:
  `CommandLine.Command.version()`, `CommandLine.Option.versionHelp()`, `isVersionHelpRequested()`

#### printVersionHelp

    public void printVersionHelp(java.io.PrintStream out,
                                 CommandLine.Help.Ansi ansi,
                                 java.lang.Object... params)

Prints version information from the `CommandLine.Command.version()` annotation to the specified `PrintStream`. Each element of the array of version strings is formatted with the specified parameters, and printed on a separate line. Both version strings and parameters may contain markup for colors and style.

Parameters:
  `out` - the printStream to print to
  `ansi` - whether the usage message should include ANSI escape codes or not
  `params` - Arguments referenced by the format specifiers in the version strings
Since:
  1.0.0
See Also:
  `CommandLine.Command.version()`, `CommandLine.Option.versionHelp()`, `isVersionHelpRequested()`

#### call

    public static <C extends java.util.concurrent.Callable<T>,T> T call(C callable,
                                                                        java.lang.String... args)

Delegates to `call(Callable, PrintStream, PrintStream, Help.Ansi, String...)` with `System.out` for requested usage help messages, `System.err` for diagnostic error messages, and `CommandLine.Help.Ansi.AUTO`.

Type Parameters:
  `C` - the annotated object must implement Callable
  `T` - the return type of the most specific command (must implement `Callable`)
Parameters:
  `callable` - the command to call when parsing succeeds.
  `args` - the command line arguments to parse
Returns:
  `null` if an error occurred while parsing the command line options, or if help was requested and printed. Otherwise returns the result of calling the Callable
Throws:
  `CommandLine.InitializationException` - if the specified command object does not have a `CommandLine.Command`, `CommandLine.Option` or `CommandLine.Parameters` annotation
  `CommandLine.ExecutionException` - if the Callable throws an exception
Since:
  3.0
See Also:
  `call(Callable, PrintStream, PrintStream, Help.Ansi, String...)`, `parseWithHandlers(IParseResultHandler2, IExceptionHandler2, String...)`

#### call

    public static <C extends java.util.concurrent.Callable<T>,T> T call(C callable,
                                                                        java.io.PrintStream out,
                                                                        java.lang.String... args)

Delegates to `call(Callable, PrintStream, PrintStream, Help.Ansi, String...)` with `System.err` for diagnostic error messages and `CommandLine.Help.Ansi.AUTO`.

Type Parameters:
  `C` - the annotated object must implement Callable
  `T` - the return type of the most specific command (must implement `Callable`)
Parameters:
  `callable` - the command to call when parsing succeeds.
  `out` - the printStream to print the usage help message to when the user requested help
  `args` - the command line arguments to parse
Returns:
  `null` if an error occurred while parsing the command line options, or if help was requested and printed. Otherwise returns the result of calling the Callable
Throws:
  `CommandLine.InitializationException` - if the specified command object does not have a `CommandLine.Command`, `CommandLine.Option` or `CommandLine.Parameters` annotation
  `CommandLine.ExecutionException` - if the Callable throws an exception
See Also:
  `call(Callable, PrintStream, PrintStream, Help.Ansi, String...)`, `parseWithHandlers(IParseResultHandler2, IExceptionHandler2, String...)`, `CommandLine.RunLast`

#### call

    public static <C extends java.util.concurrent.Callable<T>,T> T call(C callable,
                                                                        java.io.PrintStream out,
                                                                        CommandLine.Help.Ansi ansi,
                                                                        java.lang.String... args)

Delegates to `call(Callable, PrintStream, PrintStream, Help.Ansi, String...)` with `System.err` for diagnostic error messages.

Type Parameters:
  `C` - the annotated object must implement Callable
  `T` - the return type of the most specific command (must implement `Callable`)
Parameters:
  `callable` - the command to call when parsing succeeds.
  `out` - the printStream to print the usage help message to when the user requested help
  `ansi` - the ANSI style to use
  `args` - the command line arguments to parse
Returns:
  `null` if an error occurred while parsing the command line options, or if help was requested and printed. Otherwise returns the result of calling the Callable
Throws:
  `CommandLine.InitializationException` - if the specified command object does not have a `CommandLine.Command`, `CommandLine.Option` or `CommandLine.Parameters` annotation
  `CommandLine.ExecutionException` - if the Callable throws an exception
See Also:
  `call(Callable, PrintStream, PrintStream, Help.Ansi, String...)`, `parseWithHandlers(IParseResultHandler2, IExceptionHandler2, String...)`, `CommandLine.RunLast`

#### call

    public static <C extends java.util.concurrent.Callable<T>,T> T call(C callable,
                                                                        java.io.PrintStream out,
                                                                        java.io.PrintStream err,
                                                                        CommandLine.Help.Ansi ansi,
                                                                        java.lang.String... args)

Convenience method to allow command line application authors to avoid some boilerplate code in their application. The annotated object needs to implement `Callable`. Calling this method is equivalent to:

     CommandLine cmd = new CommandLine(callable);
     List<Object> results = cmd.parseWithHandlers(new RunLast().useOut(out).useAnsi(ansi),
                                                  new DefaultExceptionHandler().useErr(err).useAnsi(ansi),
                                                  args);
     T result = results == null || results.isEmpty() ? null : (T) results.get(0);
     return result;

If the specified Callable command has subcommands, the last subcommand specified on the command line is executed. Commands with subcommands may be interested in calling the `parseWithHandler` method with the `CommandLine.RunAll` handler or a custom handler.

Use `call(Class, IFactory, ...)` instead of this method if you want to use a factory that performs Dependency Injection.

Type Parameters:
  `C` - the annotated object must implement Callable
  `T` - the return type of the specified `Callable`
Parameters:
  `callable` - the command to call when parsing succeeds.
  `out` - the printStream to print the usage help message to when the user requested help
  `err` - the printStream to print diagnostic messages to
  `ansi` - whether the usage message should include ANSI escape codes or not
  `args` - the command line arguments to parse
Returns:
  `null` if an error occurred while parsing the command line options, or if help was requested and printed. Otherwise returns the result of calling the Callable
Throws:
  `CommandLine.InitializationException` - if the specified command object does not have a `CommandLine.Command`, `CommandLine.Option` or `CommandLine.Parameters` annotation
  `CommandLine.ExecutionException` - if the Callable throws an exception
Since:
  3.0
See Also:
  `call(Class, IFactory, PrintStream, PrintStream, Help.Ansi, String...)`, `parseWithHandlers(IParseResultHandler2, IExceptionHandler2, String...)`, `CommandLine.RunLast`

#### call

    public static <C extends java.util.concurrent.Callable<T>,T> T call(java.lang.Class<C> callableClass,
                                                                        CommandLine.IFactory factory,
                                                                        java.lang.String... args)

Delegates to `call(Class, IFactory, PrintStream, PrintStream, Help.Ansi, String...)` with `System.out` for requested usage help messages, `System.err` for diagnostic error messages, and `CommandLine.Help.Ansi.AUTO`.

Type Parameters:
  `C` - the annotated class must implement Callable
  `T` - the return type of the most specific command (must implement `Callable`)
Parameters:
  `callableClass` - class of the command to call when parsing succeeds.
  `factory` - the factory responsible for instantiating the specified callable class and potentially inject other components
  `args` - the command line arguments to parse
Returns:
  `null` if an error occurred while parsing the command line options, or if help was requested and printed. Otherwise returns the result of calling the Callable
Throws:
  `CommandLine.InitializationException` - if the specified class cannot be instantiated by the factory, or does not have a `CommandLine.Command`, `CommandLine.Option` or `CommandLine.Parameters` annotation
  `CommandLine.ExecutionException` - if the Callable throws an exception
Since:
  3.2
See Also:
  `call(Class, IFactory, PrintStream, PrintStream, Help.Ansi, String...)`, `parseWithHandlers(IParseResultHandler2, IExceptionHandler2, String...)`

#### call

    public static <C extends java.util.concurrent.Callable<T>,T> T call(java.lang.Class<C> callableClass,
                                                                        CommandLine.IFactory factory,
                                                                        java.io.PrintStream out,
                                                                        java.lang.String... args)

Delegates to `call(Class, IFactory, PrintStream, PrintStream, Help.Ansi, String...)` with `System.err` for diagnostic error messages, and `CommandLine.Help.Ansi.AUTO`.

Type Parameters:
  `C` - the annotated class must implement Callable
  `T` - the return type of the most specific command (must implement `Callable`)
Parameters:
  `callableClass` - class of the command to call when parsing succeeds.
  `factory` - the factory responsible for instantiating the specified callable class and potentially injecting other components
  `out` - the printStream to print the usage help message to when the user requested help
  `args` - the command line arguments to parse
Returns:
  `null` if an error occurred while parsing the command line options, or if help was requested and printed. Otherwise returns the result of calling the Callable
Throws:
  `CommandLine.InitializationException` - if the specified class cannot be instantiated by the factory, or does not have a `CommandLine.Command`, `CommandLine.Option` or `CommandLine.Parameters` annotation
  `CommandLine.ExecutionException` - if the Callable throws an exception
Since:
  3.2
See Also:
  `call(Class, IFactory, PrintStream, PrintStream, Help.Ansi, String...)`, `parseWithHandlers(IParseResultHandler2, IExceptionHandler2, String...)`

#### call

    public static <C extends java.util.concurrent.Callable<T>,T> T call(java.lang.Class<C> callableClass,
                                                                        CommandLine.IFactory factory,
                                                                        java.io.PrintStream out,
                                                                        CommandLine.Help.Ansi ansi,
                                                                        java.lang.String... args)

Delegates to `call(Class, IFactory, PrintStream, PrintStream, Help.Ansi, String...)` with `System.err` for diagnostic error messages.

Type Parameters:
  `C` - the annotated class must implement Callable
  `T` - the return type of the most specific command (must implement `Callable`)
Parameters:
  `callableClass` - class of the command to call when parsing succeeds.
  `factory` - the factory responsible for instantiating the specified callable class and potentially injecting other components
  `out` - the printStream to print the usage help message to when the user requested help
  `ansi` - the ANSI style to use
  `args` - the command line arguments to parse
Returns:
  `null` if an error occurred while parsing the command line options, or if help was requested and printed. Otherwise returns the result of calling the Callable
Throws:
  `CommandLine.InitializationException` - if the specified class cannot be instantiated by the factory, or does not have a `CommandLine.Command`, `CommandLine.Option` or `CommandLine.Parameters` annotation
  `CommandLine.ExecutionException` - if the Callable throws an exception
Since:
  3.2
See Also:
  `call(Class, IFactory, PrintStream, PrintStream, Help.Ansi, String...)`, `parseWithHandlers(IParseResultHandler2, IExceptionHandler2, String...)`

#### call

    public static <C extends java.util.concurrent.Callable<T>,T> T call(java.lang.Class<C> callableClass,
                                                                        CommandLine.IFactory factory,
                                                                        java.io.PrintStream out,
                                                                        java.io.PrintStream err,
                                                                        CommandLine.Help.Ansi ansi,
                                                                        java.lang.String... args)

Convenience method to allow command line application authors to avoid some boilerplate code in their application. The specified factory will create an instance of the specified `callableClass`; use this method instead of `call(Callable, ...)` if you want to use a factory that performs Dependency Injection. The annotated class needs to implement `Callable`. Calling this method is equivalent to:

     CommandLine cmd = new CommandLine(callableClass, factory);
     List<Object> results = cmd.parseWithHandlers(new RunLast().useOut(out).useAnsi(ansi),
                                                  new DefaultExceptionHandler().useErr(err).useAnsi(ansi),
                                                  args);
     T result = results == null || results.isEmpty() ? null : (T) results.get(0);
     return result;

If the specified Callable command has subcommands, the last subcommand specified on the command line is executed. Commands with subcommands may be interested in calling the `parseWithHandler` method with the `CommandLine.RunAll` handler or a custom handler.

Type Parameters:
  `C` - the annotated class must implement Callable
  `T` - the return type of the most specific command (must implement `Callable`)
Parameters:
  `callableClass` - class of the command to call when parsing succeeds.
  `factory` - the factory responsible for instantiating the specified callable class and potentially injecting other components
  `out` - the printStream to print the usage help message to when the user requested help
  `err` - the printStream to print diagnostic messages to
  `ansi` - the ANSI style to use
  `args` - the command line arguments to parse
Returns:
  `null` if an error occurred while parsing the command line options, or if help was requested and printed. Otherwise returns the result of calling the Callable
Throws:
  `CommandLine.InitializationException` - if the specified class cannot be instantiated by the factory, or does not have a `CommandLine.Command`, `CommandLine.Option` or `CommandLine.Parameters` annotation
  `CommandLine.ExecutionException` - if the Callable throws an exception
Since:
  3.2
See Also:
  `call(Class, IFactory, PrintStream, PrintStream, Help.Ansi, String...)`, `call(Callable, PrintStream, PrintStream, Help.Ansi, String...)`, `parseWithHandlers(IParseResultHandler2, IExceptionHandler2, String...)`

#### run

    public static <R extends java.lang.Runnable> void run(R runnable,
                                                          java.lang.String... args)

Delegates to `run(Runnable, PrintStream, PrintStream, Help.Ansi, String...)` with `System.out` for requested usage help messages, `System.err` for diagnostic error messages, and `CommandLine.Help.Ansi.AUTO`.

Type Parameters:
  `R` - the annotated object must implement Runnable
Parameters:
  `runnable` - the command to run when parsing succeeds.
  `args` - the command line arguments to parse
Throws:
  `CommandLine.InitializationException` - if the specified command object does not have a `CommandLine.Command`, `CommandLine.Option` or `CommandLine.Parameters` annotation
  `CommandLine.ExecutionException` - if the Runnable throws an exception
Since:
  3.0
See Also:
  `run(Runnable, PrintStream, PrintStream, Help.Ansi, String...)`, `parseWithHandlers(IParseResultHandler2, IExceptionHandler2, String...)`, `CommandLine.RunLast`

#### run

    public static <R extends java.lang.Runnable> void run(R runnable,
                                                          java.io.PrintStream out,
                                                          java.lang.String... args)

Delegates to `run(Runnable, PrintStream, PrintStream, Help.Ansi, String...)` with `System.err` for diagnostic error messages and `CommandLine.Help.Ansi.AUTO`.

Type Parameters:
  `R` - the annotated object must implement Runnable
Parameters:
  `runnable` - the command to run when parsing succeeds.
  `out` - the printStream to print the usage help message to when the user requested help
  `args` - the command line arguments to parse
Throws:
  `CommandLine.InitializationException` - if the specified command object does not have a `CommandLine.Command`, `CommandLine.Option` or `CommandLine.Parameters` annotation
  `CommandLine.ExecutionException` - if the Runnable throws an exception
See Also:
  `run(Runnable, PrintStream, PrintStream, Help.Ansi, String...)`, `parseWithHandler(IParseResultHandler2, String[])`, `CommandLine.RunLast`

#### run

    public static <R extends java.lang.Runnable> void run(R runnable,
                                                          java.io.PrintStream out,
                                                          CommandLine.Help.Ansi ansi,
                                                          java.lang.String... args)

Delegates to `run(Runnable, PrintStream, PrintStream, Help.Ansi, String...)` with `System.err` for diagnostic error messages.

Type Parameters:
  `R` - the annotated object must implement Runnable
Parameters:
  `runnable` - the command to run when parsing succeeds.
  `out` - the printStream to print the usage help message to when the user requested help
  `ansi` - whether the usage message should include ANSI escape codes or not
  `args` - the command line arguments to parse
Throws:
  `CommandLine.InitializationException` - if the specified command object does not have a `CommandLine.Command`, `CommandLine.Option` or `CommandLine.Parameters` annotation
  `CommandLine.ExecutionException` - if the Runnable throws an exception
See Also:
  `run(Runnable, PrintStream, PrintStream, Help.Ansi, String...)`, `parseWithHandlers(IParseResultHandler2, IExceptionHandler2, String...)`, `CommandLine.RunLast`

#### run

    public static <R extends java.lang.Runnable> void run(R runnable,
                                                          java.io.PrintStream out,
                                                          java.io.PrintStream err,
                                                          CommandLine.Help.Ansi ansi,
                                                          java.lang.String... args)

Convenience method to allow command line application authors to avoid some boilerplate code in their application. The annotated object needs to implement `Runnable`. Calling this method is equivalent to:

     CommandLine cmd = new CommandLine(runnable);
     cmd.parseWithHandlers(new RunLast().useOut(out).useAnsi(ansi),
                           new DefaultExceptionHandler().useErr(err).useAnsi(ansi),
                           args);

If the specified Runnable command has subcommands, the last subcommand specified on the command line is executed. Commands with subcommands may be interested in calling the `parseWithHandler` method with the `CommandLine.RunAll` handler or a custom handler.

From picocli v2.0, this method prints usage help or version help if requested, and any exceptions thrown by the `Runnable` are caught and rethrown wrapped in an `ExecutionException`.

Use `run(Class, IFactory, ...)` instead of this method if you want to use a factory that performs Dependency Injection.

Type Parameters:
  `R` - the annotated object must implement Runnable
Parameters:
  `runnable` - the command to run when parsing succeeds.
  `out` - the printStream to print the usage help message to when the user requested help
  `err` - the printStream to print diagnostic messages to
  `ansi` - whether the usage message should include ANSI escape codes or not
  `args` - the command line arguments to parse
Throws:
  `CommandLine.InitializationException` - if the specified command object does not have a `CommandLine.Command`, `CommandLine.Option` or `CommandLine.Parameters` annotation
  `CommandLine.ExecutionException` - if the Runnable throws an exception
Since:
  3.0
See Also:
  `parseWithHandlers(IParseResultHandler2, IExceptionHandler2, String...)`, `CommandLine.RunLast`, `run(Class, IFactory, PrintStream, PrintStream, Help.Ansi, String...)`

#### run

    public static <R extends java.lang.Runnable> void run(java.lang.Class<R> runnableClass,
                                                          CommandLine.IFactory factory,
                                                          java.lang.String... args)

Delegates to `run(Class, IFactory, PrintStream, PrintStream, Help.Ansi, String...)` with `System.out` for requested usage help messages, `System.err` for diagnostic error messages, and `CommandLine.Help.Ansi.AUTO`.

Type Parameters:
  `R` - the annotated class must implement Runnable
Parameters:
  `runnableClass` - class of the command to run when parsing succeeds.
  `factory` - the factory responsible for instantiating the specified Runnable class and potentially injecting other components
  `args` - the command line arguments to parse
Throws:
  `CommandLine.InitializationException` - if the specified class cannot be instantiated by the factory, or does not have a `CommandLine.Command`, `CommandLine.Option` or `CommandLine.Parameters` annotation
  `CommandLine.ExecutionException` - if the Runnable throws an exception
Since:
  3.2
See Also:
  `run(Class, IFactory, PrintStream, PrintStream, Help.Ansi, String...)`, `parseWithHandlers(IParseResultHandler2, IExceptionHandler2, String...)`, `CommandLine.RunLast`

#### run

    public static <R extends java.lang.Runnable> void run(java.lang.Class<R> runnableClass,
                                                          CommandLine.IFactory factory,
                                                          java.io.PrintStream out,
                                                          java.lang.String... args)

Delegates to `run(Class, IFactory, PrintStream, PrintStream, Help.Ansi, String...)` with `System.err` for diagnostic error messages, and `CommandLine.Help.Ansi.AUTO`.

Type Parameters:
  `R` - the annotated class must implement Runnable
Parameters:
  `runnableClass` - class of the command to run when parsing succeeds.
  `factory` - the factory responsible for instantiating the specified Runnable class and potentially injecting other components
  `out` - the printStream to print the usage help message to when the user requested help
  `args` - the command line arguments to parse
Throws:
  `CommandLine.InitializationException` - if the specified class cannot be instantiated by the factory, or does not have a `CommandLine.Command`, `CommandLine.Option` or `CommandLine.Parameters` annotation
  `CommandLine.ExecutionException` - if the Runnable throws an exception
Since:
  3.2
See Also:
  `run(Class, IFactory, PrintStream, PrintStream, Help.Ansi, String...)`, `parseWithHandlers(IParseResultHandler2, IExceptionHandler2, String...)`, `CommandLine.RunLast`

#### run

    public static <R extends java.lang.Runnable> void run(java.lang.Class<R> runnableClass,
                                                          CommandLine.IFactory factory,
                                                          java.io.PrintStream out,
                                                          CommandLine.Help.Ansi ansi,
                                                          java.lang.String... args)

Delegates to `run(Class, IFactory, PrintStream, PrintStream, Help.Ansi, String...)` with `System.err` for diagnostic error messages.

Type Parameters:
  `R` - the annotated class must implement Runnable
Parameters:
  `runnableClass` - class of the command to run when parsing succeeds.
  `factory` - the factory responsible for instantiating the specified Runnable class and potentially injecting other components
  `out` - the printStream to print the usage help message to when the user requested help
  `ansi` - whether the usage message should include ANSI escape codes or not
  `args` - the command line arguments to parse
Throws:
  `CommandLine.InitializationException` - if the specified class cannot be instantiated by the factory, or does not have a `CommandLine.Command`, `CommandLine.Option` or `CommandLine.Parameters` annotation
  `CommandLine.ExecutionException` - if the Runnable throws an exception
Since:
  3.2
See Also:
  `run(Class, IFactory, PrintStream, PrintStream, Help.Ansi, String...)`, `parseWithHandlers(IParseResultHandler2, IExceptionHandler2, String...)`, `CommandLine.RunLast`

#### run

    public static <R extends java.lang.Runnable> void run(java.lang.Class<R> runnableClass,
                                                          CommandLine.IFactory factory,
                                                          java.io.PrintStream out,
                                                          java.io.PrintStream err,
                                                          CommandLine.Help.Ansi ansi,
                                                          java.lang.String... args)

Convenience method to allow command line application authors to avoid some boilerplate code in their application. The specified factory will create an instance of the specified `runnableClass`; use this method instead of `run(Runnable, ...)` if you want to use a factory that performs Dependency Injection. The annotated class needs to implement `Runnable`. Calling this method is equivalent to:

     CommandLine cmd = new CommandLine(runnableClass, factory);
     cmd.parseWithHandlers(new RunLast().useOut(out).useAnsi(ansi),
                           new DefaultExceptionHandler().useErr(err).useAnsi(ansi),
                           args);

If the specified Runnable command has subcommands, the last subcommand specified on the command line is executed. Commands with subcommands may be interested in calling the `parseWithHandler` method with the `CommandLine.RunAll` handler or a custom handler.

This method prints usage help or version help if requested, and any exceptions thrown by the `Runnable` are caught and rethrown wrapped in an `ExecutionException`.

Type Parameters:
  `R` - the annotated class must implement Runnable
Parameters:
  `runnableClass` - class of the command to run when parsing succeeds.
  `factory` - the factory responsible for instantiating the specified Runnable class and potentially injecting other components
  `out` - the printStream to print the usage help message to when the user requested help
  `err` - the printStream to print diagnostic messages to
  `ansi` - whether the usage message should include ANSI escape codes or not
  `args` - the command line arguments to parse
Throws:
  `CommandLine.InitializationException` - if the specified class cannot be instantiated by the factory, or does not have a `CommandLine.Command`, `CommandLine.Option` or `CommandLine.Parameters` annotation
  `CommandLine.ExecutionException` - if the Runnable throws an exception
Since:
  3.2
See Also:
  `run(Class, IFactory, PrintStream, PrintStream, Help.Ansi, String...)`, `run(Runnable, PrintStream, PrintStream, Help.Ansi, String...)`, `parseWithHandlers(IParseResultHandler2, IExceptionHandler2, String...)`, `CommandLine.RunLast`

#### invoke

    public static java.lang.Object invoke(java.lang.String methodName,
                                          java.lang.Class<?> cls,
                                          java.lang.String... args)

Delegates to `invoke(String, Class, PrintStream, PrintStream, Help.Ansi, String...)` with `System.out` for requested usage help messages, `System.err` for diagnostic error messages, and `CommandLine.Help.Ansi.AUTO`.

Parameters:
  `methodName` - the `@Command`-annotated method to build a `CommandLine.Model.CommandSpec` model from, and run when parsing succeeds.
  `cls` - the class where the `@Command`-annotated method is declared, or a subclass
  `args` - the command line arguments to parse
Throws:
  `CommandLine.InitializationException` - if the specified method does not have a `CommandLine.Command` annotation, or if the specified class contains multiple `@Command`-annotated methods with the specified name
  `CommandLine.ExecutionException` - if the Runnable throws an exception
Since:
  3.6
See Also:
  `invoke(String, Class, PrintStream, PrintStream, Help.Ansi, String...)`, `parseWithHandlers(IParseResultHandler2, IExceptionHandler2, String...)`

#### invoke

    public static java.lang.Object invoke(java.lang.String methodName,
                                          java.lang.Class<?> cls,
                                          java.io.PrintStream out,
                                          java.lang.String... args)

Delegates to `invoke(String, Class, PrintStream, PrintStream, Help.Ansi, String...)` with the specified stream for requested usage help messages, `System.err` for diagnostic error messages, and `CommandLine.Help.Ansi.AUTO`.

Parameters:
  `methodName` - the `@Command`-annotated method to build a `CommandLine.Model.CommandSpec` model from, and run when parsing succeeds.
  `cls` - the class where the `@Command`-annotated method is declared, or a subclass
  `out` - the printstream to print requested help message to
  `args` - the command line arguments to parse
Throws:
  `CommandLine.InitializationException` - if the specified method does not have a `CommandLine.Command` annotation, or if the specified class contains multiple `@Command`-annotated methods with the specified name
  `CommandLine.ExecutionException` - if the Runnable throws an exception
Since:
  3.6
See Also:
  `invoke(String, Class, PrintStream, PrintStream, Help.Ansi, String...)`, `parseWithHandlers(IParseResultHandler2, IExceptionHandler2, String...)`

#### invoke

    public static java.lang.Object invoke(java.lang.String methodName,
                                          java.lang.Class<?> cls,
                                          java.io.PrintStream out,
                                          CommandLine.Help.Ansi ansi,
                                          java.lang.String... args)

Delegates to `invoke(String, Class, PrintStream, PrintStream, Help.Ansi, String...)` with the specified stream for requested usage help messages, `System.err` for diagnostic error messages, and the specified Ansi mode.

Parameters:
  `methodName` - the `@Command`-annotated method to build a `CommandLine.Model.CommandSpec` model from, and run when parsing succeeds.
  `cls` - the class where the `@Command`-annotated method is declared, or a subclass
  `out` - the printstream to print requested help message to
  `ansi` - whether the usage message should include ANSI escape codes or not
  `args` - the command line arguments to parse
Throws:
  `CommandLine.InitializationException` - if the specified method does not have a `CommandLine.Command` annotation, or if the specified class contains multiple `@Command`-annotated methods with the specified name
  `CommandLine.ExecutionException` - if the Runnable throws an exception
Since:
  3.6
See Also:
  `invoke(String, Class, PrintStream, PrintStream, Help.Ansi, String...)`, `parseWithHandlers(IParseResultHandler2, IExceptionHandler2, String...)`

#### invoke

    public static java.lang.Object invoke(java.lang.String methodName,
                                          java.lang.Class<?> cls,
                                          java.io.PrintStream out,
                                          java.io.PrintStream err,
                                          CommandLine.Help.Ansi ansi,
                                          java.lang.String... args)

Convenience method to allow command line application authors to avoid some boilerplate code in their application. Constructs a `CommandLine.Model.CommandSpec` model from the `@Option` and `@Parameters`-annotated method parameters of the `@Command`-annotated method, parses the specified command line arguments and invokes the specified method. Calling this method is equivalent to:

     Method commandMethod = getCommandMethods(cls, methodName).get(0);
     CommandLine cmd = new CommandLine(commandMethod);
     List<Object> list = cmd.parseWithHandlers(new RunLast().useOut(out).useAnsi(ansi),
                                               new DefaultExceptionHandler().useErr(err).useAnsi(ansi),
                                               args);
     return list == null ? null : list.get(0);

Parameters:
  `methodName` - the `@Command`-annotated method to build a `CommandLine.Model.CommandSpec` model from, and run when parsing succeeds.
  `cls` - the class where the `@Command`-annotated method is declared, or a subclass
  `out` - the printStream to print the usage help message to when the user requested help
  `err` - the printStream to print diagnostic messages to
  `ansi` - whether the usage message should include ANSI escape codes or not
  `args` - the command line arguments to parse
Throws:
  `CommandLine.InitializationException` - if the specified method does not have a `CommandLine.Command` annotation, or if the specified class contains multiple `@Command`-annotated methods with the specified name
  `CommandLine.ExecutionException` - if the method throws an exception
Since:
  3.6
See Also:
  `parseWithHandlers(IParseResultHandler2, IExceptionHandler2, String...)`

#### getCommandMethods

    public static java.util.List<java.lang.reflect.Method> getCommandMethods(java.lang.Class<?> cls,
                                                                             java.lang.String methodName)

Helper to get methods of a class annotated with `@Command` via reflection, optionally filtered by method name (not `@Command.name`). Methods have to be either public (inherited) members or be declared by `cls`, that is "inherited" static or protected methods will not be picked up.

Parameters:
  `cls` - the class to search for methods annotated with `@Command`
  `methodName` - if not `null`, return only methods whose method name (not `@Command.name`) equals this string. Ignored if `null`.
Returns:
  the matching command methods, or an empty list
Since:
  3.6.0
See Also:
  `invoke(String, Class, String...)`

#### registerConverter

    public <K> CommandLine registerConverter(java.lang.Class<K> cls,
                                             CommandLine.ITypeConverter<K> converter)

Registers the specified type converter for the specified class. When initializing fields annotated with `CommandLine.Option`, the field's type is used as a lookup key to find the associated type converter, and this type converter converts the original command line argument string value to the correct type.

Java 8 lambdas make it easy to register custom type converters:

     commandLine.registerConverter(java.nio.file.Path.class, s -> java.nio.file.Paths.get(s));
     commandLine.registerConverter(java.time.Duration.class, s -> java.time.Duration.parse(s));

Built-in type converters are pre-registered for the following java 1.5 types:

- all primitive types
- all primitive wrapper types: Boolean, Byte, Character, Double, Float, Integer, Long, Short
- any enum
- java.io.File
- java.math.BigDecimal
- java.math.BigInteger
- java.net.InetAddress
- java.net.URI
- java.net.URL
- java.nio.charset.Charset
- java.sql.Time
- java.util.Date
- java.util.UUID
- java.util.regex.Pattern
- StringBuilder
- CharSequence
- String

The specified converter will be registered with this `CommandLine` and the full hierarchy of its subcommands and nested sub-subcommands at the moment the converter is registered. Subcommands added later will not have this converter added automatically. To ensure a custom type converter is available to all subcommands, register the type converter last, after adding subcommands.

Type Parameters:
  `K` - the target type
Parameters:
  `cls` - the target class to convert parameter string values to
  `converter` - the class capable of converting string values to the specified target type
Returns:
  this CommandLine object, to allow method chaining
See Also:
  `addSubcommand(String, Object)`

#### getSeparator

    public java.lang.String getSeparator()

Returns the String that separates option names from option values when parsing command line options.

Returns:
  the String the parser uses to separate option names from option values
See Also:
  `CommandLine.Model.ParserSpec.separator()`

#### setSeparator

    public CommandLine setSeparator(java.lang.String separator)

Sets the String the parser uses to separate option names from option values to the specified value. The separator may also be set declaratively with the `CommandLine.Command.separator()` annotation attribute.

The specified setting will be registered with this `CommandLine` and the full hierarchy of its subcommands and nested sub-subcommands at the moment this method is called. Subcommands added later will have the default setting. To ensure a setting is applied to all subcommands, call the setter last, after adding subcommands.

Parameters:
  `separator` - the String that separates option names from option values
Returns:
  this `CommandLine` object, to allow method chaining
See Also:
  `CommandLine.Model.ParserSpec.separator(String)`

#### getResourceBundle

    public java.util.ResourceBundle getResourceBundle()

Returns the ResourceBundle of this command or `null` if no resource bundle is set.

Since:
  3.6
See Also:
  `CommandLine.Command.resourceBundle()`, `CommandLine.Model.CommandSpec.resourceBundle()`

#### setResourceBundle

    public CommandLine setResourceBundle(java.util.ResourceBundle bundle)

Sets the ResourceBundle containing usage help message strings.

The specified bundle will be registered with this `CommandLine` and the full hierarchy of its subcommands and nested sub-subcommands at the moment this method is called. Subcommands added later will not be impacted. To ensure a setting is applied to all subcommands, call the setter last, after adding subcommands.

Parameters:
  `bundle` - the ResourceBundle containing usage help message strings
Returns:
  this `CommandLine` object, to allow method chaining
Since:
  3.6
See Also:
  `CommandLine.Command.resourceBundle()`, `CommandLine.Model.CommandSpec.resourceBundle(ResourceBundle)`

#### getUsageHelpWidth

    public int getUsageHelpWidth()

Returns the maximum width of the usage help message. The default is 80.

See Also:
  `CommandLine.Model.UsageMessageSpec.width()`

#### setUsageHelpWidth

    public CommandLine setUsageHelpWidth(int width)

Sets the maximum width of the usage help message. Longer lines are wrapped.

The specified setting will be registered with this `CommandLine` and the full hierarchy of its subcommands and nested sub-subcommands at the moment this method is called. Subcommands added later will have the default setting. To ensure a setting is applied to all subcommands, call the setter last, after adding subcommands.

Parameters:
  `width` - the maximum width of the usage help message
Returns:
  this `CommandLine` object, to allow method chaining
See Also:
  `CommandLine.Model.UsageMessageSpec.width(int)`

#### getCommandName

    public java.lang.String getCommandName()

Returns the command name (also called program name) displayed in the usage help synopsis.

Returns:
  the command name (also called program name) displayed in the usage
Since:
  2.0
See Also:
  `CommandLine.Model.CommandSpec.name()`

#### setCommandName

    public CommandLine setCommandName(java.lang.String commandName)

Sets the command name (also called program name) displayed in the usage help synopsis to the specified value. Note that this method only modifies the usage help message, it does not impact parsing behaviour. The command name may also be set declaratively with the `CommandLine.Command.name()` annotation attribute.

Parameters:
  `commandName` - command name (also called program name) displayed in the usage help synopsis
Returns:
  this `CommandLine` object, to allow method chaining
Since:
  2.0
See Also:
  `CommandLine.Model.CommandSpec.name(String)`

#### isExpandAtFiles

    public boolean isExpandAtFiles()

Returns 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. This property is `true` by default.

Returns:
  whether "argument files" or `@files` should be expanded into their content
Since:
  2.1

#### setExpandAtFiles

    public 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. (`true` by default.)

Parameters:
  `expandAtFiles` - whether "argument files" or `@files` should be expanded into their content
Returns:
  this `CommandLine` object, to allow method chaining
Since:
  2.1

#### getAtFileCommentChar

    public java.lang.Character getAtFileCommentChar()

Returns the character that starts a single-line comment or `null` if all content of argument files should be interpreted as arguments (without comments). If specified, all characters from the comment character to the end of the line are ignored.

Returns:
  the character that starts a single-line comment or `null`. The default is `'#'`.
Since:
  3.5

#### setAtFileCommentChar

    public CommandLine setAtFileCommentChar(java.lang.Character atFileCommentChar)

Sets the character that starts a single-line comment or `null` if all content of argument files should be interpreted as arguments (without comments). If specified, all characters from the comment character to the end of the line are ignored.

Parameters:
  `atFileCommentChar` - the character that starts a single-line comment or `null`. The default is `'#'`.
Returns:
  this `CommandLine` object, to allow method chaining
Since:
  3.5

#### isUseSimplifiedAtFiles

    public boolean isUseSimplifiedAtFiles()

Returns whether to use a simplified argument file format that is compatible with JCommander. In this format, every line (except empty lines and comment lines) is interpreted as a single argument. Arguments containing whitespace do not need to be quoted. When system property `"picocli.useSimplifiedAtFiles"` is defined, the system property value overrides the programmatically set value.

Returns:
  whether to use a simplified argument file format. The default is `false`.
Since:
  3.9

#### setUseSimplifiedAtFiles

    public CommandLine setUseSimplifiedAtFiles(boolean simplifiedAtFiles)

Sets whether to use a simplified argument file format that is compatible with JCommander. In this format, every line (except empty lines and comment lines) is interpreted as a single argument. Arguments containing whitespace do not need to be quoted. When system property `"picocli.useSimplifiedAtFiles"` is defined, the system property value overrides the programmatically set value.

Parameters:
  `simplifiedAtFiles` - whether to use a simplified argument file format. The default is `false`.
Returns:
  this `CommandLine` object, to allow method chaining
Since:
  3.9