Package io.github.qishr.cascara.common.util
Interface IHelpCommandInitializable
java.lang.Object
io.github.qishr.cascara.common.util.CommandLine.IHelpCommandInitializable
Enclosing Class:
io.github.qishr.cascara.common.util.CommandLine
All Known Implementing Classes:
HelpCommand
public static interface IHelpCommandInitializable
Help commands that provide usage help for other commands can implement this interface to be initialized with the information they need.
The #printHelpIfRequested(List, PrintStream, PrintStream, Help.Ansi) method calls the
init method on commands marked as Command#helpCommand()
before the help command's run or call method is called.
Implementation note:
If an error occurs in the run or call method while processing the help request, it is recommended custom Help
commands throw a ParameterException with a reference to the parent command. The DefaultExceptionHandler will print
the error message and the usage for the parent command, and will terminate with the exit code of the exception handler if one was set.
Method Summary
| Modifier and Type | Method | Description |
|---|---|---|
| public abstract void | init(CommandLine helpCommandLine, Ansi ansi, PrintStream out, PrintStream err) | Initializes this object with the information needed to implement a help command that provides usage help for other commands. |
Method Details
init
public abstract void init(CommandLine helpCommandLine, Ansi ansi, PrintStream out, PrintStream err)
Initializes this object with the information needed to implement a help command that provides usage help for other commands.
Deprecation
This has been marked as deprecated.
Parameters:
helpCommandLine - the CommandLine 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.
ansi - whether to use Ansi colors or not
out - the stream to print the usage help message to
err - the error stream to print any diagnostic messages to, in addition to the output from the exception handler