From 31e64eaaf4e3381058826bf1f1ab9beb98c379b1 Mon Sep 17 00:00:00 2001 From: Jesse Boyd Date: Wed, 19 Apr 2017 05:39:46 +1000 Subject: [PATCH] Include flags in documentation --- .../com/boydti/fawe/util/DocumentationPrinter.java | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/core/src/main/java/com/boydti/fawe/util/DocumentationPrinter.java b/core/src/main/java/com/boydti/fawe/util/DocumentationPrinter.java index 668488fb..175a4451 100644 --- a/core/src/main/java/com/boydti/fawe/util/DocumentationPrinter.java +++ b/core/src/main/java/com/boydti/fawe/util/DocumentationPrinter.java @@ -75,7 +75,13 @@ public final class DocumentationPrinter { "Command documentation will be consistent with what is available ingame"); stream.println(); stream.println(); - stream.print("To view this information ingame use `//help`"); + stream.print("To view this information ingame use `//help [category|command]`\n"); + stream.print("## Command Syntax \n"); + stream.print(" - `` - A required parameter \n"); + stream.print(" - `[arg]` - An optional parameter \n"); + stream.print(" - `` - Multiple parameters options \n"); + stream.print(" - `` - Default or suggested value \n"); + stream.print(" - `-a` - A command flag e.g. `// -a [flag-value]`"); stream.println(); stream.print("## See also\n"); stream.print(" - [Masks](https://github.com/boy0001/FastAsyncWorldedit/wiki/WorldEdit---FAWE-mask-list)\n"); @@ -148,7 +154,7 @@ public final class DocumentationPrinter { Command cmd = method.getAnnotation(Command.class); String[] aliases = cmd.aliases(); String usage = prefix + aliases[0] + " " + cmd.usage(); - if (cmd.anyFlags()) { + if (!cmd.flags().isEmpty()) { for (char c : cmd.flags().toCharArray()) { usage += " [-" + c + "]"; } @@ -159,7 +165,8 @@ public final class DocumentationPrinter { CommandPermissions perms = method.getAnnotation(CommandPermissions.class); stream.append("**Perm**: `" + StringMan.join(perms.value(), "`, `") + "` \n"); } - stream.append("**Desc**: " + cmd.desc().trim().replaceAll("\n", "
") + " \n"); + String help = cmd.help() == null || cmd.help().isEmpty() ? cmd.desc() : cmd.help(); + stream.append("**Desc**: " + help.trim().replaceAll("\n", "
") + " \n"); if (method.isAnnotationPresent(NestedCommand.class)) { NestedCommand nested =