initial commit2
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
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}" }
|
||||
}
|
||||
Reference in New Issue
Block a user