From 21fde3deb02d06aa1d4423cb41055329aec08446 Mon Sep 17 00:00:00 2001 From: KKlochko Date: Mon, 26 Jun 2023 18:11:14 +0300 Subject: [PATCH] Add the show all option for Source. --- CHANGELOG.org | 2 ++ pyproject.toml | 2 +- tui_rsync/cli/source/source_show.py | 13 ++++++++++++- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.org b/CHANGELOG.org index 8d386f6..2bf6000 100644 --- a/CHANGELOG.org +++ b/CHANGELOG.org @@ -57,4 +57,6 @@ Added *show one* option for Source. ** 0.8.14 <2023-06-25 Sun> Added *show one* option for Group. +** 0.8.15 <2023-06-26 Mon> + Added *show all* option for Source. diff --git a/pyproject.toml b/pyproject.toml index 63f382c..8151a35 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "tui-rsync" -version = "0.8.14" +version = "0.8.15" description = "tui-rsync will help you to manage yours backups." authors = ["Kostiantyn Klochko "] readme = "README.rst" diff --git a/tui_rsync/cli/source/source_show.py b/tui_rsync/cli/source/source_show.py index d774aad..b3cff4c 100644 --- a/tui_rsync/cli/source/source_show.py +++ b/tui_rsync/cli/source/source_show.py @@ -24,6 +24,7 @@ import typer from tui_rsync.models.models import Source, Destination, SyncCommand, Path from tui_rsync.cli.label_prompt import LabelPrompt +from tui_rsync.models.models import all_labels console = Console() source_show = typer.Typer() @@ -37,7 +38,7 @@ def one( ), ): """ - [green b]Show[/] an [yellow]existing source label[/]. + [green b]Show[/] an [yellow]existing source[/]. """ if label is None: console.print("What is the [yellow b]label of source[/]? ") @@ -51,3 +52,13 @@ def one( console.print(source.show_format()) +@source_show.command() +def all(): + """ + [green b]Show[/] [yellow]all existing sources[/]. + """ + + for label in all_labels().iterator(): + source = Source.get_source(label.label) + console.print(source.show_format()) +