public abstract class Command
extends java.lang.Object
implements java.io.Closeable
Modifier and Type | Field and Description |
---|---|
protected java.lang.String |
description
A description of the command, used in the help output.
|
protected joptsimple.OptionParser |
parser
The option parser for this command.
|
Constructor and Description |
---|
Command(java.lang.String description) |
Modifier and Type | Method and Description |
---|---|
protected boolean |
addShutdownHook()
Return whether or not to install the shutdown hook to cleanup resources on exit.
|
void |
close() |
protected abstract void |
execute(Terminal terminal,
joptsimple.OptionSet options)
Executes this command.
|
protected static void |
exit(int status) |
int |
main(java.lang.String[] args,
Terminal terminal)
Parses options for this command from args and executes it.
|
protected void |
printAdditionalHelp(Terminal terminal)
Prints additional help information, specific to the command
|
protected boolean |
shouldConfigureLoggingWithoutConfig()
Indicate whether or not logging should be configured without reading a log4j2.properties.
|
protected final java.lang.String description
protected final joptsimple.OptionParser parser
public final int main(java.lang.String[] args, Terminal terminal) throws java.lang.Exception
java.lang.Exception
protected boolean shouldConfigureLoggingWithoutConfig()
protected void printAdditionalHelp(Terminal terminal)
protected static void exit(int status)
protected abstract void execute(Terminal terminal, joptsimple.OptionSet options) throws java.lang.Exception
UserException
.java.lang.Exception
protected boolean addShutdownHook()
public void close() throws java.io.IOException
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
java.io.IOException