From e8773c72b19b7de7f9a6b112f2c92d275488e1b1 Mon Sep 17 00:00:00 2001 From: KKlochko Date: Sat, 24 Jun 2023 17:29:09 +0300 Subject: [PATCH] Add the show format for the Source. --- tui_rsync/models/models.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tui_rsync/models/models.py b/tui_rsync/models/models.py index 8ac642f..f65be74 100644 --- a/tui_rsync/models/models.py +++ b/tui_rsync/models/models.py @@ -109,6 +109,18 @@ class Source(BaseModel): def __repr__(self) -> str: return f"{self.label}" + + def show_format(self) -> str: + output = f"[b]label:[/] {self.label}\n" \ + f"[b]source:[/] {self.source.path}\n" \ + f"[b]args:[/] {self.args}\n" \ + f"[b]destionations:[/] \n" + + for destination in self.destinations: + output+=f"\t{destination.path}\n" + + return output + class Destination(BaseModel): source = ForeignKeyField(Source, backref='destinations') path = ForeignKeyField(Path)