16 lines
613 B
Kotlin
16 lines
613 B
Kotlin
package commands
|
|
|
|
import models.HumanBeing
|
|
import runner.CommandInvoker
|
|
|
|
class HelpCommand(private val invoker: CommandInvoker) : ClientCommand {
|
|
override val name = "help"
|
|
override val description = "вывести справку по доступным командам"
|
|
override val args = listOf(CommandArgType.NONE)
|
|
override val type = CommandType.SIMPLE
|
|
|
|
override fun execute(args: List<String>, humanBeing: HumanBeing?): String =
|
|
invoker.getCommands().values
|
|
.sortedBy { it.name }
|
|
.joinToString("\n") { " ${it.name.padEnd(40)} — ${it.description}" }
|
|
} |