initial commit2
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
package commands
|
||||
|
||||
import collection.CollectionManager
|
||||
import kotlinx.serialization.Contextual
|
||||
import kotlinx.serialization.Serializable
|
||||
import models.HumanBeing
|
||||
import network.Response
|
||||
|
||||
@Serializable
|
||||
class ShowCommand(@Contextual private val manager: CollectionManager) : Command {
|
||||
override val name = "show"
|
||||
override val description = "вывести все элементы коллекции"
|
||||
override val type = CommandType.SIMPLE
|
||||
override val args = listOf(CommandArgType.NONE)
|
||||
|
||||
override fun execute(args: List<String>, humanBeing: HumanBeing?, userId: String): Response {
|
||||
if (manager.isEmpty()) return Response(true, "Коллекция пуста.")
|
||||
return Response(true, manager.getAll().joinToString("\n") { it.toString() })
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user