From 299d703f248e6b844721b8273cbcf38dbfbd50a2 Mon Sep 17 00:00:00 2001 From: Kenzie Togami Date: Thu, 29 Aug 2019 19:58:00 -0700 Subject: [PATCH] [Doctools] Fix //expand listing, ensure no missed commands --- .../sk89q/worldedit/internal/util/DocumentationPrinter.kt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/worldedit-core/doctools/src/main/kotlin/com/sk89q/worldedit/internal/util/DocumentationPrinter.kt b/worldedit-core/doctools/src/main/kotlin/com/sk89q/worldedit/internal/util/DocumentationPrinter.kt index 0e76154c6..c6b94b86b 100644 --- a/worldedit-core/doctools/src/main/kotlin/com/sk89q/worldedit/internal/util/DocumentationPrinter.kt +++ b/worldedit-core/doctools/src/main/kotlin/com/sk89q/worldedit/internal/util/DocumentationPrinter.kt @@ -57,6 +57,7 @@ class DocumentationPrinter private constructor() { .map { it.name to it }.toList().toMap() private val cmdOutput = StringBuilder() private val permsOutput = StringBuilder() + private val matchedCommands = mutableSetOf() private suspend inline fun SequenceScope.yieldAllCommandsIn() { val sourceFile = Paths.get("worldedit-core/src/main/java/" + T::class.qualifiedName!!.replace('.', '/') + ".java") @@ -93,7 +94,7 @@ class DocumentationPrinter private constructor() { dumpSection("Selection Commands") { yieldAllCommandsIn() - yieldAllCommandsIn() + yield("/expand") } dumpSection("Region Commands") { @@ -144,6 +145,9 @@ class DocumentationPrinter private constructor() { } writeFooter() + + val missingCommands = commands.keys.filterNot { it in matchedCommands } + require(missingCommands.isEmpty()) { "Missing commands: $missingCommands" } } private fun writeHeader() { @@ -214,6 +218,7 @@ Other Permissions val prefix = TextConfig.getCommandPrefix() val commands = sequence(addCommandNames).map { this.commands.getValue(it) }.toList() + matchedCommands.addAll(commands.map { it.name }) cmdsToPerms(commands, prefix)