Files
Lab5-Prog/src/main/kotlin/commands/SaveCommand.kt
T
2026-03-07 10:31:30 +03:00

22 lines
587 B
Kotlin

package commands
import collection.CollectionManager
import file.FileManager
/**
* Сохраняет коллекцию в CSV-файл.
* @property manager менеджер коллекции
* @property fileManager менеджер файла
*/
class SaveCommand(
private val manager: CollectionManager,
private val fileManager: FileManager
) : Command {
override val name = "save"
override val description = "сохранить коллекцию в файл"
override fun execute(args: List<String>) {
fileManager.write(manager.getAll())
}
}