21 lines
646 B
Kotlin
21 lines
646 B
Kotlin
package commands
|
|
|
|
import database.Repository
|
|
import kotlinx.serialization.Contextual
|
|
import kotlinx.serialization.Serializable
|
|
import models.HumanBeing
|
|
import network.Response
|
|
|
|
@Serializable
|
|
class ClearCommand(@Contextual private val manager: Repository) : Command {
|
|
override val name = "clear"
|
|
override val description = "очистить коллекцию"
|
|
override val args = listOf(CommandArgType.NONE)
|
|
override val type = CommandType.SIMPLE
|
|
|
|
override fun execute(args: List<String>, humanBeing: HumanBeing?): Response {
|
|
manager.clear()
|
|
return Response(true, "Коллекция очищена.")
|
|
}
|
|
}
|