Added support for help text to be shown on syntax errors and such.

Dieser Commit ist enthalten in:
TomyLobo 2011-12-05 10:38:44 +01:00
Ursprung fcb7e62cb0
Commit 6764704c22
2 geänderte Dateien mit 12 neuen und 1 gelöschten Zeilen

Datei anzeigen

@ -67,4 +67,9 @@ public @interface Command {
* meaning that if it is given it must have a value
*/
String flags() default "";
/**
* A long description for the command.
*/
String help() default "";
}

Datei anzeigen

@ -242,7 +242,7 @@ public abstract class CommandsManager<T> {
* @return
*/
protected String getUsage(String[] args, int level, Command cmd) {
StringBuilder command = new StringBuilder();
final StringBuilder command = new StringBuilder();
command.append('/');
@ -262,6 +262,12 @@ public abstract class CommandsManager<T> {
}
command.append(cmd.usage());
final String help = cmd.help();
if (!help.isEmpty()) {
command.append("\n\n");
command.append(help);
}
return command.toString();
}