Add some tests, minor Checkstyle fixes

This commit is contained in:
ljacqu
2017-07-16 12:59:33 +02:00
parent 7c48cf59c7
commit 4ac980111d
22 changed files with 435 additions and 34 deletions
@@ -140,10 +140,15 @@ public class GeneratePluginYml implements AutoToolTask {
}
private static String buildUsage(CommandDescription command) {
if (!command.getArguments().isEmpty()) {
return CommandUtils.buildSyntax(command);
}
final String commandStart = "/" + command.getLabels().get(0);
if (!command.getArguments().isEmpty()) {
// Command has arguments, so generate something like /authme register <password> <confirmPass>
final String arguments = command.getArguments().stream()
.map(CommandUtils::formatArgument)
.collect(Collectors.joining(" "));
return commandStart + " " + arguments;
}
// Argument-less command, list all children: /authme register|login|firstspawn|spawn|...
String usage = commandStart + " " + command.getChildren()
.stream()
.filter(cmd -> !cmd.getLabels().contains("help"))