Package picocli
Interface CommandLine.IHelpCommandInitializable2
-
- All Known Implementing Classes:
CommandLine.HelpCommand
- Enclosing class:
- CommandLine
public static interface CommandLine.IHelpCommandInitializable2
Help commands that provide usage help for other commands can implement this interface to be initialized with the information they need.The
CommandLine::printHelpIfRequested
method calls theinit
method on commands marked ashelpCommand
before the help command'srun
orcall
method is called.Implementation note:
If an error occurs in the
run
orcall
method while processing the help request, it is recommended custom Help commands throw aParameterException
with a reference to the parent command. Thedefault ParameterException handler
will print the error message and the usage for the parent command.- Since:
- 4.0
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
init(CommandLine helpCommandLine, CommandLine.Help.ColorScheme colorScheme, PrintWriter outWriter, PrintWriter errWriter)
Initializes this object with the information needed to implement a help command that provides usage help for other commands.
-
-
-
Method Detail
-
init
void init(CommandLine helpCommandLine, CommandLine.Help.ColorScheme colorScheme, PrintWriter outWriter, PrintWriter errWriter)
Initializes this object with the information needed to implement a help command that provides usage help for other commands.- Parameters:
helpCommandLine
- theCommandLine
object associated with this help command. Implementors can use this to walk the command hierarchy and get access to the help command's parent and sibling commands.colorScheme
- the color scheme to use when printing help, including whether to use Ansi colors or notoutWriter
- the output writer to print the usage help message toerrWriter
- the error writer to print any diagnostic messages to, in addition to the output from the exception handler
-
-