From 719f2577390ed5b374d240fe6eecd527b31c587a Mon Sep 17 00:00:00 2001 From: "Max P." Date: Sun, 11 May 2025 14:40:50 +0200 Subject: [PATCH] feat(cli): add verbose option to status command - Introduces a `--verbose` flag to the `status` command for detailed output - Displays repository details, including age, size, and Git status - Enhances usability by providing more granular information on request --- src/repocat/cli/status.py | 39 +++++++++++++++++++++++++++++++++++++-- 1 file changed, 37 insertions(+), 2 deletions(-) diff --git a/src/repocat/cli/status.py b/src/repocat/cli/status.py index e20b508..bfa19db 100644 --- a/src/repocat/cli/status.py +++ b/src/repocat/cli/status.py @@ -1,4 +1,4 @@ -from typer import Typer +from typer import Typer, Option from rich.console import Console from rich.table import Table from repocat.config import load_config @@ -8,7 +8,7 @@ app = Typer() console = Console() @app.command("status") -def status(): +def status(verbose: bool = Option(False, "--verbose", "-v", help="Zeige Details zu einzelnen Repositories")): """ Zeigt eine Übersicht über alle Repository-Kategorien. """ @@ -47,3 +47,38 @@ def status(): ) console.print(table) + + if verbose: + for category in catalog.categories: + if category.config.is_archive: + continue + + if not category.repos: + continue + + repo_table = Table(title=f"Details: {category.config.name}") + repo_table.add_column("Repository") + repo_table.add_column("Alter (Tage)", justify="right") + repo_table.add_column("Größe (MB)", justify="right") + repo_table.add_column("Git", justify="left") + + for repo in sorted(category.repos, key=lambda r: r.age_days, reverse=True): + git_status = "" + if repo.git: + if repo.git.dirty: + git_status += "uncommitted " + if repo.git.unpushed: + git_status += "unpushed" + if not git_status: + git_status = "clean" + else: + git_status = "–" + + repo_table.add_row( + repo.name, + str(repo.age_days), + f"{repo.size_mb:.1f}", + git_status.strip() + ) + + console.print(repo_table)