mirror of
https://gitlab.com/KKlochko/tui-rsync.git
synced 2026-08-20 05:37:43 +00:00
Update the show all plans command to show if there're no plans.
This commit is contained in:
@@ -20,7 +20,8 @@
|
||||
from rich.console import Console
|
||||
import typer
|
||||
|
||||
from tui_rsync.core.components.backup_plan.application.queries import GetAllBackupBackupPlansQuery
|
||||
from tui_rsync.core.components.backup_plan.application.services import GetAllBackupPlansService, \
|
||||
GetBackupPlanCountService
|
||||
|
||||
from tui_rsync.core.components.backup_plan.application.services.backup_plan_service import BackupPlanService
|
||||
from tui_rsync.core.shared_kernel.components.common import UUID
|
||||
@@ -48,16 +49,8 @@ def one(
|
||||
|
||||
service: BackupPlanService = CurrentConfiguration.get(BackupPlanService)
|
||||
|
||||
if id is None:
|
||||
console.print("[red b][ERROR][/] Backup plan does not exists!!!")
|
||||
return
|
||||
|
||||
plan = service.get_by_id(UUID(id))
|
||||
|
||||
if plan is None:
|
||||
console.print("[red b][ERROR][/] Backup plan does not exists!!!")
|
||||
return
|
||||
|
||||
console.print(BackupPlanFormat.format(plan))
|
||||
|
||||
|
||||
@@ -67,7 +60,10 @@ def all():
|
||||
[green b]Show[/] [yellow]all existing backup plans[/].
|
||||
"""
|
||||
|
||||
query = CurrentConfiguration.get(GetAllBackupBackupPlansQuery)
|
||||
|
||||
for backup_plan in query.execute():
|
||||
console.print(BackupPlanFormat.format(backup_plan))
|
||||
count_service = CurrentConfiguration.get(GetBackupPlanCountService)
|
||||
if count_service.is_empty():
|
||||
console.print("No backup plans.")
|
||||
else:
|
||||
service = CurrentConfiguration.get(GetAllBackupPlansService)
|
||||
for backup_plan in service.get_all():
|
||||
console.print(BackupPlanFormat.format(backup_plan))
|
||||
|
||||
Reference in New Issue
Block a user