public abstract class AbstractCommand extends java.lang.Object implements Command
Modifier and Type | Field and Description |
---|---|
protected Config |
config
The configuration of the shell session.
|
protected java.lang.String |
description
The description of the command.
|
protected java.lang.String |
name
The name of the command.
|
protected org.jline.terminal.Terminal |
terminal
The virtual terminal used by the shell.
|
protected java.io.PrintWriter |
writer
The text-output stream of the terminal.
|
EXIT_ERROR, EXIT_SUCCESS
Modifier | Constructor and Description |
---|---|
protected |
AbstractCommand(Context context,
java.lang.String name,
java.lang.String description)
Creates a new command.
|
Modifier and Type | Method and Description |
---|---|
void |
close() |
org.jline.reader.Completer |
getCompleter()
Gets a completer to generate tab-completion candidates of this command
and its arguments.
|
java.lang.String |
getDescription()
Gets a brief explanation of what the command does.
|
java.lang.String |
getName()
Gets the name of the command.
|
void |
printHelp(java.io.PrintWriter printer)
Prints a detailed description of what the command does.
|
protected final java.lang.String name
protected final java.lang.String description
protected final org.jline.terminal.Terminal terminal
protected final Config config
protected final java.io.PrintWriter writer
protected AbstractCommand(Context context, java.lang.String name, java.lang.String description)
context
- the context of the shell sessionname
- the name of the commanddescription
- the description of the commandpublic java.lang.String getName()
Command
public java.lang.String getDescription()
Command
Command.printHelp(java.io.PrintWriter)
.getDescription
in interface Command
public org.jline.reader.Completer getCompleter()
Command
getCompleter
in interface Command
public void printHelp(java.io.PrintWriter printer)
Command
public void close() throws java.lang.Exception
close
in interface java.lang.AutoCloseable
java.lang.Exception