Class CommandLine.RunFirst
java.lang.Object
org.apache.logging.log4j.core.tools.picocli.CommandLine.RunFirst
- All Implemented Interfaces:
CommandLine.IParseResultHandler
- Enclosing class:
CommandLine
Command line parse result handler that prints help if requested, and otherwise executes the top-level
Runnable or Callable command.
For use in the parseWithHandler methods.
From picocli v2.0, RunFirst is used to implement the run
and call convenience 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-levelRunnableorCallablecommand.
-
Constructor Details
-
RunFirst
public RunFirst()
-
-
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-levelRunnableorCallablecommand. If the top-level command does not implement eitherRunnableorCallable, aExecutionExceptionis thrown detailing the problem and capturing the offendingCommandLineobject.- Specified by:
handleParseResultin interfaceCommandLine.IParseResultHandler- Parameters:
parsedCommands- theCommandLineobjects that resulted from successfully parsing the command line argumentsout- thePrintStreamto 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 a single element: the result of calling the
Callable, or anullelement if the top-level command was aRunnable - Throws:
CommandLine.ExecutionException- if a problem occurred while processing the parse results; useCommandLine.ExecutionException.getCommandLine()to get the command or subcommand where processing failed
-