feat(cli): add verbose option to status command
All checks were successful
Auto Changelog & Release / detect-version-change (push) Successful in 4s
Auto Changelog & Release / release (push) Has been skipped
Auto Changelog & Release / changelog-only (push) Successful in 7s
Build and Publish nightly package / build-and-publish (push) Successful in 50s
All checks were successful
Auto Changelog & Release / detect-version-change (push) Successful in 4s
Auto Changelog & Release / release (push) Has been skipped
Auto Changelog & Release / changelog-only (push) Successful in 7s
Build and Publish nightly package / build-and-publish (push) Successful in 50s
- 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
This commit is contained in:
@@ -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)
|
||||
|
Reference in New Issue
Block a user