Files
Lab8-Prog/client/src/main/kotlin/commands/HelpCommand.kt
T
2026-06-12 12:28:00 +03:00

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}" }
}