Skip to content

Commit d9b2dda

Browse files
committed
fix: fix flags completion
1 parent 0fb1f44 commit d9b2dda

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

bukkit-kotlin/src/main/kotlin/cn/afternode/commons/bukkit/kotlin/command/CompositeCommand.kt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,13 +210,18 @@ class SubCommand(
210210
"-${resolver.key}"
211211
else
212212
"--${resolver.key}"
213-
if (last.startsWith(comp))
213+
if (comp.startsWith(last))
214214
results += comp
215215
}
216216
} else {
217217
val last = this.keyedFlags[parsed.lastFlag!!.lowercase()]
218218
if (last != null) {
219+
val comp = if (last.key.length == 1)
220+
"-${last.key}"
221+
else
222+
"--${last.key}"
219223
results += last.completion(sender, parsed.flags[parsed.lastFlag] ?: "")
224+
.map { "$comp=$it" }
220225
}
221226
}
222227

0 commit comments

Comments
 (0)