public interface CommandPlugin extends Plugin
The main advantage to creating a command plug-in rather than providing an external command or script is that command plug-ins get access to the
BladeRunnerJS model. Commands can be invoked by users using the 'brjs' command, or can be invoked programmatically using the
BRJS.runCommand(java.lang.String...)
method.
A JSAPArgsParsingCommandPlugin
class is available for developers that would like help
parsing the command parameters for their command.
The following methods are identifier-methods, and may be invoked before Plugin.setBRJS()
has been invoked:
Modifier and Type | Method and Description |
---|---|
int |
doCommand(java.lang.String... args)
Runs the command using the provided user arguments.
|
java.lang.String |
getCommandDescription()
Returns a description message that helps users to determine whether a command may be of interest to them or not.
|
java.lang.String |
getCommandHelp()
Returns a detailed help message that describes the various parameters the command provides, and how they are used.
|
java.lang.String |
getCommandName()
Returns the name of the command.
|
java.lang.String |
getCommandUsage()
Returns a usage message that shows the user an example of how the command parameters are used.
|
castTo, close, getPluginClass, instanceOf, setBRJS
java.lang.String getCommandName()
Note: Developers should not rely on any class initialization performed within Plugin.setBRJS()
as this
method is an identifier-method which may be invoked before Plugin.setBRJS()
has itself been
invoked.
java.lang.String getCommandDescription()
java.lang.String getCommandUsage()
Note: This method doesn't need to be implemented if you've chosen to extend JSAPArgsParsingCommandPlugin
.
java.lang.String getCommandHelp()
Note: This method doesn't need to be implemented if you've chosen to extend JSAPArgsParsingCommandPlugin
.
int doCommand(java.lang.String... args) throws CommandArgumentsException, CommandOperationException
args
- The list of arguments provided by the user.CommandArgumentsException
- if any invalid arguments were provided.CommandOperationException
- if a problem was encountered while running the command.