From fceb22396a0fa110cb85dfada261909b0cc88fb2 Mon Sep 17 00:00:00 2001 From: KKlochko Date: Sun, 25 Jun 2023 18:02:46 +0300 Subject: [PATCH] Add the prefix for Source's show_format. --- tui_rsync/models/models.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tui_rsync/models/models.py b/tui_rsync/models/models.py index f65be74..99f8f92 100644 --- a/tui_rsync/models/models.py +++ b/tui_rsync/models/models.py @@ -110,7 +110,7 @@ class Source(BaseModel): def __repr__(self) -> str: return f"{self.label}" - def show_format(self) -> str: + def show_format(self, prefix='') -> str: output = f"[b]label:[/] {self.label}\n" \ f"[b]source:[/] {self.source.path}\n" \ f"[b]args:[/] {self.args}\n" \ @@ -119,6 +119,10 @@ class Source(BaseModel): for destination in self.destinations: output+=f"\t{destination.path}\n" + if prefix != '': + keepends = True + output = prefix + f'{prefix}'.join(output.splitlines(keepends)) + return output class Destination(BaseModel):