mirror of
https://gitlab.com/KKlochko/tui-rsync.git
synced 2026-08-12 17:57:43 +00:00
(Added) sync all function.
Added all_labels_except for choosing many labels. Added fzf function for using all_labels_except.
This commit is contained in:
@@ -21,7 +21,7 @@ from rich.console import Console
|
||||
from rich.prompt import Prompt
|
||||
from pyfzf import FzfPrompt
|
||||
import uuid
|
||||
from models.models import all_labels
|
||||
from models.models import all_labels, all_labels_except
|
||||
|
||||
console = Console()
|
||||
|
||||
@@ -37,6 +37,12 @@ class LabelPrompt:
|
||||
label = Prompt.ask(question, default=uid)
|
||||
return label
|
||||
|
||||
@staticmethod
|
||||
def get_label_fzf() -> str:
|
||||
fzf = FzfPrompt()
|
||||
return fzf.prompt(all_labels().iterator())
|
||||
|
||||
@staticmethod
|
||||
def get_label_except_fzf(labels = None) -> str:
|
||||
fzf = FzfPrompt()
|
||||
return fzf.prompt(all_labels_except(labels).iterator())
|
||||
|
||||
@@ -23,6 +23,7 @@ from typing import List, Optional
|
||||
import typer
|
||||
|
||||
from models.models import Source, Destination, SyncCommand, Path
|
||||
from models.models import all_labels
|
||||
from cli.label_prompt import LabelPrompt
|
||||
from cli.rsync import Rsync
|
||||
|
||||
@@ -47,3 +48,10 @@ def one(
|
||||
for dest in src.destinations:
|
||||
rsync.run_one(str(src.source), str(dest))
|
||||
|
||||
@sync.command()
|
||||
def all():
|
||||
"""
|
||||
[green b]Sync[/] [yellow]all sources[/] with theirs backups.
|
||||
"""
|
||||
for label in all_labels().iterator():
|
||||
one(label.label)
|
||||
|
||||
Reference in New Issue
Block a user