public class InvalidUsageException extends CommandException
When handling this exception, print the error message if it is not null.
Print a one line help instruction unless isFullHelpSuggested()
is true, which, in that case, the full help of the command should be
shown.
If no error message is set and full help is not to be shown, then a generic "you used this command incorrectly" message should be shown.
Constructor and Description |
---|
InvalidUsageException(CommandCallable command)
Create a new instance with no error message and with no suggestion
that full and complete help for the command should be shown.
|
InvalidUsageException(java.lang.String message,
CommandCallable command)
Create a new instance with a message and with no suggestion
that full and complete help for the command should be shown.
|
InvalidUsageException(java.lang.String message,
CommandCallable command,
boolean fullHelpSuggested)
Create a new instance with a message.
|
Modifier and Type | Method and Description |
---|---|
CommandCallable |
getCommand()
Get the command.
|
java.lang.String |
getSimpleUsageString(java.lang.String prefix)
Get a simple usage string.
|
boolean |
isFullHelpSuggested()
Return whether the full usage of the command should be shown.
|
getCommandUsed, prependStack
public InvalidUsageException(CommandCallable command)
command
- the commandpublic InvalidUsageException(@Nullable java.lang.String message, CommandCallable command)
message
- the messagecommand
- the commandpublic InvalidUsageException(@Nullable java.lang.String message, CommandCallable command, boolean fullHelpSuggested)
message
- the messagecommand
- the commandfullHelpSuggested
- true if the full help for the command should be shownpublic CommandCallable getCommand()
public java.lang.String getSimpleUsageString(java.lang.String prefix)
prefix
- the command shebang (such as "/") -- may be blankpublic boolean isFullHelpSuggested()