public abstract class Command
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
java.util.Map<java.lang.String,Command> |
childCommands
List of available subcommands
|
| Constructor and Description |
|---|
Command() |
Command(java.util.Map<java.lang.String,Command> childCommands) |
| Modifier and Type | Method and Description |
|---|---|
org.jline.reader.Candidate |
buildCandidate(CommandHandler.Category category,
java.lang.String commandName)
Creates a JLine candidate that appears in the list of available options when you press TAB
|
java.util.List<org.jline.reader.Candidate> |
complete(java.util.List<java.lang.String> words,
int wordIndex,
java.lang.String word)
Returns a list of available options for the next word for the current command.
|
abstract java.lang.String |
getArgsDescription() |
abstract java.lang.String |
getUsageDescription() |
abstract void |
invoke(java.lang.String... args)
Run current command
|
void |
invokeSubcommands(java.lang.String... args)
Transfer control to subcommands
|
protected static java.lang.String |
parseUsername(java.lang.String username) |
protected static java.util.UUID |
parseUUID(java.lang.String s) |
protected void |
verifyArgs(java.lang.String[] args,
int min) |
public java.util.Map<java.lang.String,Command> childCommands
public Command()
public Command(java.util.Map<java.lang.String,Command> childCommands)
protected static java.lang.String parseUsername(java.lang.String username)
throws CommandException
CommandExceptionprotected static java.util.UUID parseUUID(java.lang.String s)
throws CommandException
CommandExceptionpublic abstract java.lang.String getArgsDescription()
public abstract java.lang.String getUsageDescription()
public org.jline.reader.Candidate buildCandidate(CommandHandler.Category category, java.lang.String commandName)
category - this command categorycommandName - this command namepublic java.util.List<org.jline.reader.Candidate> complete(java.util.List<java.lang.String> words,
int wordIndex,
java.lang.String word)
words - list all user wordswordIndex - current word indexword - current wordpublic void invokeSubcommands(java.lang.String... args)
throws java.lang.Exception
args - command arguments(includes subcommand name)java.lang.Exception - Error executing commandpublic abstract void invoke(java.lang.String... args)
throws java.lang.Exception
args - command argumentsjava.lang.Exception - Error executing commandprotected final void verifyArgs(java.lang.String[] args,
int min)
throws CommandException
CommandException