feat(command): add show empty validation
This commit is contained in:
@@ -12,8 +12,12 @@ class Show(
|
|||||||
override val description = "show collection elements"
|
override val description = "show collection elements"
|
||||||
|
|
||||||
override fun execute() {
|
override fun execute() {
|
||||||
|
if (collectionManager.getCollection().isNotEmpty()) {
|
||||||
for (product in collectionManager.getCollection()) {
|
for (product in collectionManager.getCollection()) {
|
||||||
io.println(product.toString())
|
io.println(product.toString())
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
io.println("коллекция пустая")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user