This commit is contained in:
2026-01-11 04:54:27 -08:00
parent bf8ef6d128
commit 5f8f49c530
6 changed files with 239 additions and 69 deletions

View File

@@ -77,23 +77,108 @@ def capture_rich_output(*, stdout: TextIO, stderr: TextIO) -> Iterator[None]:
def show_provider_config_panel(
provider_name: str,
keys: Sequence[str] | None = None,
*,
config_hint: str = "config.conf"
provider_names: str | List[str],
) -> None:
"""Show a Rich panel explaining how to configure a provider."""
pass
"""Show a Rich panel explaining how to configure providers."""
from rich.table import Table
from rich.text import Text
from rich.console import Group
if isinstance(provider_names, str):
providers = [p.strip() for p in provider_names.split(",")]
else:
providers = provider_names
table = Table.grid(padding=(0, 1))
table.add_column(style="bold red")
for provider in providers:
table.add_row(f"{provider}")
group = Group(
Text("The following providers are not configured and cannot be used:\n"),
table,
Text.from_markup("\nTo configure them, run the command with [bold cyan].config[/bold cyan] or use the [bold green]TUI[/bold green] config menu.")
)
panel = Panel(
group,
title="[bold red]Configuration Required[/bold red]",
border_style="red",
padding=(1, 2)
)
stdout_console().print()
stdout_console().print(panel)
def show_store_config_panel(
store_type: str,
keys: Sequence[str] | None = None,
*,
config_hint: str = "config.conf"
store_names: str | List[str],
) -> None:
"""Show a Rich panel explaining how to configure a storage backend."""
pass
"""Show a Rich panel explaining how to configure storage backends."""
from rich.table import Table
from rich.text import Text
from rich.console import Group
if isinstance(store_names, str):
stores = [s.strip() for s in store_names.split(",")]
else:
stores = store_names
table = Table.grid(padding=(0, 1))
table.add_column(style="bold yellow")
for store in stores:
table.add_row(f"{store}")
group = Group(
Text("The following stores are not configured or available:\n"),
table,
Text.from_markup("\nInitialize them using [bold cyan].config[/bold cyan] or ensure they are properly set up.")
)
panel = Panel(
group,
title="[bold yellow]Store Not Configured[/bold yellow]",
border_style="yellow",
padding=(1, 2)
)
stdout_console().print()
stdout_console().print(panel)
def show_available_providers_panel(provider_names: List[str]) -> None:
"""Show a Rich panel listing available/configured providers."""
from rich.columns import Columns
from rich.console import Group
from rich.text import Text
if not provider_names:
return
# Use Columns to display them efficiently in the panel
cols = Columns(
[f"[bold green] \u2713 [/bold green]{p}" for p in sorted(provider_names)],
equal=True,
column_first=True,
expand=True
)
group = Group(
Text("The following providers are configured and ready to use:\n"),
cols
)
panel = Panel(
group,
title="[bold green]Configured Providers[/bold green]",
border_style="green",
padding=(1, 2)
)
stdout_console().print()
stdout_console().print(panel)
IMAGE_EXTENSIONS = {".jpg", ".jpeg", ".png", ".gif", ".webp", ".bmp", ".tiff"}