Package picocli
Class CommandLine.HelpCommand
- java.lang.Object
-
- picocli.CommandLine.HelpCommand
-
- All Implemented Interfaces:
Runnable,CommandLine.IHelpCommandInitializable
- Enclosing class:
- CommandLine
public static final class CommandLine.HelpCommand extends Object implements CommandLine.IHelpCommandInitializable, Runnable
Help command that can be installed as a subcommand on all application commands. When invoked with a subcommand argument, it prints usage help for the specified subcommand. For example:// print help for subcommand command help subcommand
When invoked without additional parameters, it prints usage help for the parent command. For example:
// print help for command command help
For internationalization: this command has a--helpoption withdescriptionKey = "helpCommand.help", and aCOMMANDpositional parameter withdescriptionKey = "helpCommand.command".- Since:
- 3.0
-
-
Constructor Summary
Constructors Constructor Description HelpCommand()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidinit(CommandLine helpCommandLine, CommandLine.Help.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.voidrun()Invokesusagefor the specified command, or for the parent command.
-
-
-
Method Detail
-
run
public void run()
Invokesusagefor the specified command, or for the parent command.
-
init
public void init(CommandLine helpCommandLine, CommandLine.Help.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.- Specified by:
initin interfaceCommandLine.IHelpCommandInitializable- Parameters:
helpCommandLine- theCommandLineobject 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 notout- the stream to print the usage help message toerr- the error stream to print any diagnostic messages to, in addition to the output from the exception handler
-
-