public static class CommandLine.RunAll extends CommandLine.AbstractParseResultHandler<java.util.List<java.lang.Object>> implements CommandLine.IParseResultHandler
Runnable or Callable.
For use in the parseWithHandler methods.| Constructor and Description |
|---|
RunAll() |
| Modifier and Type | Method and Description |
|---|---|
protected java.util.List<java.lang.Object> |
handle(CommandLine.ParseResult parseResult)
Executes the top-level command and all subcommands as
Runnable or Callable. |
java.util.List<java.lang.Object> |
handleParseResult(java.util.List<CommandLine> parsedCommands,
java.io.PrintStream out,
CommandLine.Help.Ansi ansi)
Prints help if requested, and otherwise executes the top-level command and all subcommands as
Runnable
or Callable. |
protected CommandLine.RunAll |
self()
Returns
this to allow method chaining when calling the setters for a fluent API. |
handleParseResultandExit, ansi, err, exit, exitCode, hasExitCode, out, returnResultOrExit, throwOrExit, useAnsi, useErr, useOutpublic java.util.List<java.lang.Object> handleParseResult(java.util.List<CommandLine> parsedCommands, java.io.PrintStream out, CommandLine.Help.Ansi ansi)
Runnable
or Callable. Finally, either a list of result objects is returned, or the JVM is terminated if an exit
code was set. If any of the CommandLine commands does not implement either
Runnable or Callable, an ExecutionException
is thrown detailing the problem and capturing the offending CommandLine object.handleParseResult in interface CommandLine.IParseResultHandlerparsedCommands - the CommandLine objects that resulted from successfully parsing the command line argumentsout - the PrintStream to print help to if requestedansi - for printing help messages using ANSI styles and colorsCallable commands, null elements for commands that implement RunnableCommandLine.ParameterException - if the HelpCommand was invoked for an unknown subcommand. Any ParameterExceptions
thrown from this method are treated as if this exception was thrown during parsing and passed to the CommandLine.IExceptionHandlerCommandLine.ExecutionException - if a problem occurred while processing the parse results; use
CommandLine.ExecutionException.getCommandLine() to get the command or subcommand where processing failedprotected java.util.List<java.lang.Object> handle(CommandLine.ParseResult parseResult) throws CommandLine.ExecutionException
Runnable or Callable.
If any of the CommandLine commands does not implement either Runnable or Callable, an ExecutionException
is thrown detailing the problem and capturing the offending CommandLine object.handle in class CommandLine.AbstractParseResultHandler<java.util.List<java.lang.Object>>parseResult - the ParseResult that resulted from successfully parsing the command line argumentsCallable commands, null elements for commands that implement RunnableCommandLine.ExecutionException - if a problem occurred while processing the parse results; use
CommandLine.ExecutionException.getCommandLine() to get the command or subcommand where processing failedprotected CommandLine.RunAll self()
CommandLine.AbstractHandlerthis to allow method chaining when calling the setters for a fluent API.self in class CommandLine.AbstractHandler<java.util.List<java.lang.Object>,CommandLine.AbstractParseResultHandler<java.util.List<java.lang.Object>>>