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, humanBeing: HumanBeing?): String = invoker.getCommands().values .sortedBy { it.name } .joinToString("\n") { " ${it.name.padEnd(40)} — ${it.description}" } }