public abstract class AbstractShellCommand extends Object implements ShellCommand
| Constructor and Description |
|---|
AbstractShellCommand()
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
protected Arguments |
getArguments()
Gets the command's arguments.
|
protected ShellContext |
getContext() |
protected String |
optionalArgument(int argIndex)
Returns the optional argument at the given index.
|
protected String |
optionalArgument(int argIndex,
String defaultValue)
Returns the optional argument at the given index.
|
void |
print(String formattedMessage,
Object... params)
Prints the given message to the output stream.
|
protected String |
requiredArgument(int argIndex,
String message)
Returns the argument at the given index.
|
void |
setArguments(Arguments arguments)
Sets the arguments that can be used by this command.
|
void |
setContext(ShellContext context)
The shell context.
|
void |
setOutput(Writer output)
Configure the command's output.
|
int |
tabCompletion(String lastArgument,
List<CharSequence> candidates)
Handle tab completion for the command.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitexecute, printHelp, printUsagepublic void setContext(ShellContext context)
ShellCommandsetContext in interface ShellCommandShellCommand.setContext(org.overlord.sramp.shell.api.ShellContext)protected ShellContext getContext()
public void setArguments(Arguments arguments)
ShellCommandsetArguments in interface ShellCommandorg.overlord.sramp.shell.api.ShellCommand#setArguments(java.lang.String[])protected Arguments getArguments()
protected String requiredArgument(int argIndex, String message) throws InvalidCommandArgumentException
argIndex - message - InvalidCommandArgumentExceptionprotected String optionalArgument(int argIndex)
argIndex - protected String optionalArgument(int argIndex, String defaultValue)
argIndex - defaultValue - public void print(String formattedMessage, Object... params)
ShellCommandprint in interface ShellCommandShellCommand.print(java.lang.String, java.lang.Object[])public void setOutput(Writer output)
ShellCommandsetOutput in interface ShellCommandoutput - the output to setpublic int tabCompletion(String lastArgument, List<CharSequence> candidates)
ShellCommandtabCompletion in interface ShellCommandShellCommand.tabCompletion(java.lang.String, java.util.List)Copyright © 2011-2014 JBoss, a division of Red Hat. All Rights Reserved.