Class CommandLine.RunAll
java.lang.Object
org.apache.logging.log4j.core.tools.picocli.CommandLine.RunAll
- All Implemented Interfaces:
CommandLine.IParseResultHandler
- Enclosing class:
- CommandLine
Command line parse result handler that prints help if requested, and otherwise executes the top-level command and
all subcommands as
Runnable
or Callable
.
For use in the parseWithHandler
methods.- Since:
- 2.0
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionhandleParseResult
(List<CommandLine> parsedCommands, PrintStream out, CommandLine.Help.Ansi ansi) Prints help if requested, and otherwise executes the top-level command and all subcommands asRunnable
orCallable
.
-
Constructor Details
-
RunAll
public RunAll()
-
-
Method Details
-
handleParseResult
public List<Object> handleParseResult(List<CommandLine> parsedCommands, PrintStream out, CommandLine.Help.Ansi ansi) Prints help if requested, and otherwise executes the top-level command and all subcommands asRunnable
orCallable
. If any of theCommandLine
commands does not implement eitherRunnable
orCallable
, aExecutionException
is thrown detailing the problem and capturing the offendingCommandLine
object.- Specified by:
handleParseResult
in interfaceCommandLine.IParseResultHandler
- Parameters:
parsedCommands
- theCommandLine
objects that resulted from successfully parsing the command line argumentsout
- thePrintStream
to print help to if requestedansi
- for printing help messages using ANSI styles and colors- Returns:
- an empty list if help was requested, or a list containing the result of executing all commands:
the return values from calling the
Callable
commands,null
elements for commands that implementRunnable
- Throws:
CommandLine.ExecutionException
- if a problem occurred while processing the parse results; useCommandLine.ExecutionException.getCommandLine()
to get the command or subcommand where processing failed
-