Package picocli
Class CommandLine.HelpCommand
- java.lang.Object
-
- picocli.CommandLine.HelpCommand
-
- All Implemented Interfaces:
java.lang.Runnable
,CommandLine.IHelpCommandInitializable
,CommandLine.IHelpCommandInitializable2
- Enclosing class:
- CommandLine
public static final class CommandLine.HelpCommand extends java.lang.Object implements CommandLine.IHelpCommandInitializable, CommandLine.IHelpCommandInitializable2, java.lang.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--help
option withdescriptionKey = "helpCommand.help"
, and aCOMMAND
positional parameter withdescriptionKey = "helpCommand.command"
.- Since:
- 3.0
-
-
Field Summary
Fields Modifier and Type Field Description private CommandLine.Help.Ansi
ansi
private CommandLine.Help.ColorScheme
colorScheme
private java.lang.String[]
commands
private java.io.PrintStream
err
private java.io.PrintWriter
errWriter
private boolean
helpRequested
private java.io.PrintStream
out
private java.io.PrintWriter
outWriter
private CommandLine
self
-
Constructor Summary
Constructors Constructor Description HelpCommand()
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
init(CommandLine helpCommandLine, CommandLine.Help.Ansi ansi, java.io.PrintStream out, java.io.PrintStream err)
Deprecated.void
init(CommandLine helpCommandLine, CommandLine.Help.ColorScheme colorScheme, java.io.PrintWriter out, java.io.PrintWriter err)
Initializes this object with the information needed to implement a help command that provides usage help for other commands.void
run()
Invokesusage
for the specified command, or for the parent command.
-
-
-
Field Detail
-
helpRequested
private boolean helpRequested
-
commands
private java.lang.String[] commands
-
self
private CommandLine self
-
out
private java.io.PrintStream out
-
err
private java.io.PrintStream err
-
outWriter
private java.io.PrintWriter outWriter
-
errWriter
private java.io.PrintWriter errWriter
-
ansi
private CommandLine.Help.Ansi ansi
-
colorScheme
private CommandLine.Help.ColorScheme colorScheme
-
-
Method Detail
-
run
public void run()
Invokesusage
for the specified command, or for the parent command.- Specified by:
run
in interfacejava.lang.Runnable
-
init
@Deprecated public void init(CommandLine helpCommandLine, CommandLine.Help.Ansi ansi, java.io.PrintStream out, java.io.PrintStream err)
Deprecated.Initializes this object with the information needed to implement a help command that provides usage help for other commands.- Specified by:
init
in interfaceCommandLine.IHelpCommandInitializable
- 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.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
-
init
public void init(CommandLine helpCommandLine, CommandLine.Help.ColorScheme colorScheme, java.io.PrintWriter out, java.io.PrintWriter err)
Initializes this object with the information needed to implement a help command that provides usage help for other commands.- Specified by:
init
in interfaceCommandLine.IHelpCommandInitializable2
- 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 notout
- the output writer to print the usage help message toerr
- the error writer to print any diagnostic messages to, in addition to the output from the exception handler
-
-