updating and refining plugin system refactor
This commit is contained in:
+12
-12
@@ -77,26 +77,26 @@ def capture_rich_output(*, stdout: TextIO, stderr: TextIO) -> Iterator[None]:
|
||||
_STDERR_CONSOLE = previous_stderr
|
||||
|
||||
|
||||
def show_provider_config_panel(
|
||||
provider_names: str | List[str],
|
||||
def show_plugin_config_panel(
|
||||
plugin_names: str | List[str],
|
||||
) -> None:
|
||||
"""Show a Rich panel explaining how to configure providers."""
|
||||
"""Show a Rich panel explaining how to configure plugins."""
|
||||
from rich.table import Table as RichTable
|
||||
from rich.console import Group
|
||||
|
||||
if isinstance(provider_names, str):
|
||||
providers = [p.strip() for p in provider_names.split(",")]
|
||||
if isinstance(plugin_names, str):
|
||||
plugins = [p.strip() for p in plugin_names.split(",")]
|
||||
else:
|
||||
providers = provider_names
|
||||
plugins = plugin_names
|
||||
|
||||
table = RichTable.grid(padding=(0, 1))
|
||||
table.add_column(style="bold red")
|
||||
|
||||
for provider in providers:
|
||||
table.add_row(f" • {provider}")
|
||||
for plugin in plugins:
|
||||
table.add_row(f" • {plugin}")
|
||||
|
||||
group = Group(
|
||||
Text("The following providers are not configured and cannot be used:\n"),
|
||||
Text("The following plugins 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.")
|
||||
)
|
||||
@@ -147,17 +147,17 @@ def show_store_config_panel(
|
||||
stdout_console().print(panel)
|
||||
|
||||
|
||||
def show_available_providers_panel(provider_names: List[str]) -> None:
|
||||
def show_available_plugins_panel(plugin_names: List[str]) -> None:
|
||||
"""Show a Rich panel listing available/configured plugins."""
|
||||
from rich.columns import Columns
|
||||
from rich.console import Group
|
||||
|
||||
if not provider_names:
|
||||
if not plugin_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)],
|
||||
[f"[bold green] \u2713 [/bold green]{p}" for p in sorted(plugin_names)],
|
||||
equal=True,
|
||||
column_first=True,
|
||||
expand=True
|
||||
|
||||
Reference in New Issue
Block a user