|
|
@ -24,14 +24,18 @@ import typer
|
|
|
|
from tui_rsync.core.components.backup_plan.application.services.backup_plan_service import BackupPlanService
|
|
|
|
from tui_rsync.core.components.backup_plan.application.services.backup_plan_service import BackupPlanService
|
|
|
|
from tui_rsync.core.components.backup_plan.domain import BackupPlan, Source, Destination, BackupPlanId
|
|
|
|
from tui_rsync.core.components.backup_plan.domain import BackupPlan, Source, Destination, BackupPlanId
|
|
|
|
from tui_rsync.core.shared_kernel.components.common import Label
|
|
|
|
from tui_rsync.core.shared_kernel.components.common import Label
|
|
|
|
|
|
|
|
from tui_rsync.core.shared_kernel.ports.Exceptions import CommandException
|
|
|
|
|
|
|
|
from tui_rsync.core.shared_kernel.ports.Exceptions.query_exception import QueryException
|
|
|
|
from tui_rsync.infrastructure.configuration import CurrentConfiguration
|
|
|
|
from tui_rsync.infrastructure.configuration import CurrentConfiguration
|
|
|
|
|
|
|
|
from tui_rsync.user_interface.cli.shared_kernel.components.errors.applications.exceptions import catch_exception
|
|
|
|
|
|
|
|
|
|
|
|
console = Console()
|
|
|
|
console = Console()
|
|
|
|
update_backup_plan = typer.Typer()
|
|
|
|
update_backup_plan = typer.Typer()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@update_backup_plan.command()
|
|
|
|
@update_backup_plan.command()
|
|
|
|
|
|
|
|
@catch_exception(CommandException, 1)
|
|
|
|
|
|
|
|
@catch_exception(QueryException, 1)
|
|
|
|
def replace(
|
|
|
|
def replace(
|
|
|
|
id: str = typer.Option(
|
|
|
|
id: str = typer.Option(
|
|
|
|
None, "--id", "-i",
|
|
|
|
None, "--id", "-i",
|
|
|
@ -65,3 +69,5 @@ def replace(
|
|
|
|
plan = BackupPlan(id=BackupPlanId(id), label=Label(label), source=Source(source), destinations=[Destination(path) for path in destinations])
|
|
|
|
plan = BackupPlan(id=BackupPlanId(id), label=Label(label), source=Source(source), destinations=[Destination(path) for path in destinations])
|
|
|
|
service.update(plan)
|
|
|
|
service.update(plan)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
console.print("The backup plan updated.")
|
|
|
|
|
|
|
|
|
|
|
|