Add the show one option for Group.

dev
KKlochko 2 years ago
parent 8958e328e8
commit 8fe226b282

@ -55,4 +55,6 @@
Added *update source* option for source. Added *update source* option for source.
** 0.8.13 <2023-06-24 Sat> ** 0.8.13 <2023-06-24 Sat>
Added *show one* option for Source. Added *show one* option for Source.
** 0.8.14 <2023-06-25 Sun>
Added *show one* option for Group.

@ -1,6 +1,6 @@
[tool.poetry] [tool.poetry]
name = "tui-rsync" name = "tui-rsync"
version = "0.8.13" version = "0.8.14"
description = "tui-rsync will help you to manage yours backups." description = "tui-rsync will help you to manage yours backups."
authors = ["Kostiantyn Klochko <kostya_klochko@ukr.net>"] authors = ["Kostiantyn Klochko <kostya_klochko@ukr.net>"]
readme = "README.rst" readme = "README.rst"

@ -0,0 +1,53 @@
################################################################################
# Copyright (C) 2023 Kostiantyn Klochko <kostya_klochko@ukr.net> #
# #
# This file is part of tui-rsync. #
# #
# tui-rsync is free software: you can redistribute it and/or modify it under #
# uthe 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
from rich.prompt import Prompt
from typing import List, Optional
import typer
from tui_rsync.models.models import Group, GroupSource
from tui_rsync.cli.groups.group_prompt import GroupPrompt
console = Console()
group_show = typer.Typer()
@group_show.command()
def one(
group_label: str = typer.Option(
None, "--group-label", "-l",
help="[b]The label[/] is a uniq identification of a [b]group[/].",
show_default=False
),
):
"""
[green b]Show[/] an [yellow]existing group[/].
"""
if group_label is None:
console.print("What is the [yellow b]label of the group[/]? ")
group_label = GroupPrompt.get_label_fzf()
if not Group.is_exist(group_label):
console.print("[red b][ERROR][/] Source does not exists!!!")
return
group = Group.get_group(group_label)
console.print(group.show_format())

@ -25,11 +25,13 @@ import typer
from tui_rsync.cli.label_prompt import LabelPrompt from tui_rsync.cli.label_prompt import LabelPrompt
from tui_rsync.cli.rsync import Rsync from tui_rsync.cli.rsync import Rsync
from tui_rsync.models.models import Group, count_all_labels_except from tui_rsync.models.models import Group, count_all_labels_except
from tui_rsync.cli.groups.group_show import group_show
from tui_rsync.cli.groups.group_update import group_update from tui_rsync.cli.groups.group_update import group_update
from tui_rsync.cli.groups.group_remove import group_remove from tui_rsync.cli.groups.group_remove import group_remove
console = Console() console = Console()
groups = typer.Typer() groups = typer.Typer()
groups.add_typer(group_show, name="show", help="Show groups")
groups.add_typer(group_update, name="update", help="Update groups") groups.add_typer(group_update, name="update", help="Update groups")
groups.add_typer(group_remove, name="remove", help="Remove groups") groups.add_typer(group_remove, name="remove", help="Remove groups")

Loading…
Cancel
Save