mirror of
https://github.com/EngineHub/WorldEdit.git
synced 2024-12-15 04:41:37 +08:00
[Doctools] Fix //expand listing, ensure no missed commands
This commit is contained in:
parent
44bffc5a86
commit
299d703f24
@ -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<String>()
|
||||
|
||||
private suspend inline fun <reified T> SequenceScope<String>.yieldAllCommandsIn() {
|
||||
val sourceFile = Paths.get("worldedit-core/src/main/java/" + T::class.qualifiedName!!.replace('.', '/') + ".java")
|
||||
@ -93,7 +94,7 @@ private fun writeAllCommands() {
|
||||
|
||||
dumpSection("Selection Commands") {
|
||||
yieldAllCommandsIn<SelectionCommands>()
|
||||
yieldAllCommandsIn<ExpandCommands>()
|
||||
yield("/expand")
|
||||
}
|
||||
|
||||
dumpSection("Region Commands") {
|
||||
@ -144,6 +145,9 @@ private fun writeAllCommands() {
|
||||
}
|
||||
|
||||
writeFooter()
|
||||
|
||||
val missingCommands = commands.keys.filterNot { it in matchedCommands }
|
||||
require(missingCommands.isEmpty()) { "Missing commands: $missingCommands" }
|
||||
}
|
||||
|
||||
private fun writeHeader() {
|
||||
@ -214,6 +218,7 @@ private fun dumpSection(title: String, addCommandNames: suspend SequenceScope<St
|
||||
|
||||
val prefix = TextConfig.getCommandPrefix()
|
||||
val commands = sequence(addCommandNames).map { this.commands.getValue(it) }.toList()
|
||||
matchedCommands.addAll(commands.map { it.name })
|
||||
|
||||
cmdsToPerms(commands, prefix)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user