mirror of https://gitlab.com/KKlochko/tui-rsync
parent
359dcdfca6
commit
87682a056f
@ -0,0 +1,3 @@
|
|||||||
|
from .backup import sync
|
||||||
|
|
||||||
|
__all__ = ['sync']
|
@ -0,0 +1,56 @@
|
|||||||
|
################################################################################
|
||||||
|
# Copyright (C) 2023-2025 Kostiantyn Klochko <kklochko@protonmail.com> #
|
||||||
|
# #
|
||||||
|
# This file is part of tui-rsync. #
|
||||||
|
# #
|
||||||
|
# tui-rsync is free software: you can redistribute it and/or modify it under #
|
||||||
|
# the terms of the GNU General Public License as published by the Free #
|
||||||
|
# Software Foundation, either version 3 of the License, or (at your option) #
|
||||||
|
# any later version. #
|
||||||
|
# #
|
||||||
|
# tui-rsync is distributed in the hope that it will be useful, but WITHOUT ANY #
|
||||||
|
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS #
|
||||||
|
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more #
|
||||||
|
# details. #
|
||||||
|
# #
|
||||||
|
# You should have received a copy of the GNU General Public License along with #
|
||||||
|
# tui-rsync. If not, see <https://www.gnu.org/licenses/>. #
|
||||||
|
################################################################################
|
||||||
|
|
||||||
|
|
||||||
|
from rich.console import Console
|
||||||
|
import typer
|
||||||
|
|
||||||
|
from tui_rsync.core.shared_kernel.components.backup.application.service import BackupSyncService
|
||||||
|
from tui_rsync.core.shared_kernel.components.common import UUID
|
||||||
|
from tui_rsync.infrastructure.configuration import CurrentConfiguration
|
||||||
|
|
||||||
|
console = Console()
|
||||||
|
sync = typer.Typer()
|
||||||
|
|
||||||
|
|
||||||
|
@sync.command()
|
||||||
|
def one(
|
||||||
|
id: str = typer.Option(
|
||||||
|
None, "--id", "-i",
|
||||||
|
help="[b]The id[/] is an uniq identification of a [b]backup plan[/].",
|
||||||
|
show_default=False
|
||||||
|
),
|
||||||
|
dry: bool = typer.Option(
|
||||||
|
False, "-d", "--dry-run",
|
||||||
|
help="The command will [b]show[/] information about what will be changed.",
|
||||||
|
)
|
||||||
|
):
|
||||||
|
"""
|
||||||
|
[green b]Sync[/] a [yellow]source[/] with the [yellow b]label[/] and its backups.
|
||||||
|
[yellow b]Skips[/] if not available.
|
||||||
|
"""
|
||||||
|
|
||||||
|
service: BackupSyncService = CurrentConfiguration.get(BackupSyncService)
|
||||||
|
|
||||||
|
if id is None:
|
||||||
|
console.print("[red b][ERROR][/] Backup plan does not exists!!!")
|
||||||
|
return
|
||||||
|
|
||||||
|
# TODO add args
|
||||||
|
service.sync_by_plan_id(UUID(id), '-avuP', dry)
|
Loading…
Reference in new issue