From bbd89a100dc8ab11ce6fb7769d6e9792b3d931e4 Mon Sep 17 00:00:00 2001 From: FoXeNe Date: Tue, 3 Mar 2026 14:03:25 +0300 Subject: [PATCH] feat(command): add show empty validation --- app/src/main/kotlin/command/commands/Show.kt | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/app/src/main/kotlin/command/commands/Show.kt b/app/src/main/kotlin/command/commands/Show.kt index 2156337..ad57bc3 100644 --- a/app/src/main/kotlin/command/commands/Show.kt +++ b/app/src/main/kotlin/command/commands/Show.kt @@ -12,8 +12,12 @@ class Show( override val description = "show collection elements" override fun execute() { - for (product in collectionManager.getCollection()) { - io.println(product.toString()) + if (collectionManager.getCollection().isNotEmpty()) { + for (product in collectionManager.getCollection()) { + io.println(product.toString()) + } + } else { + io.println("коллекция пустая") } } }