|
1 | 1 | import importlib.metadata |
2 | 2 | import os |
3 | | -import subprocess |
4 | 3 | from pathlib import Path |
5 | 4 | from typing import Annotated |
6 | 5 | from importlib.metadata import PackageNotFoundError, version |
|
12 | 11 | from rich.console import Console |
13 | 12 | from rich.table import Table |
14 | 13 |
|
| 14 | +from minimal_pba_cli.util import run_external_subprocess |
| 15 | + |
15 | 16 |
|
16 | 17 | plugin = typer.Typer() |
17 | 18 |
|
@@ -156,23 +157,6 @@ def find_plugins() -> dict[str, dict[str, str]]: |
156 | 157 | return plugins |
157 | 158 |
|
158 | 159 |
|
159 | | -def run_external_subprocess(args: list[str]) -> subprocess.CompletedProcess: |
160 | | - """Run an external subprocess and return the result.""" |
161 | | - |
162 | | - result = subprocess.run(args, capture_output=True, encoding="utf-8") |
163 | | - |
164 | | - if result.stdout: |
165 | | - typer.echo(result.stdout) |
166 | | - |
167 | | - if result.stderr: |
168 | | - typer.echo(result.stderr, err=True) |
169 | | - |
170 | | - if result.returncode != 0: |
171 | | - raise typer.Exit(code=result.returncode) |
172 | | - |
173 | | - return result |
174 | | - |
175 | | - |
176 | 160 | def _get_packages_matching_name(prefix: str) -> list[dict[str, str]]: |
177 | 161 | if "LIBRARIES_IO_API_KEY" not in os.environ: |
178 | 162 | typer.secho( |
@@ -222,7 +206,7 @@ def _display_plugin_list(): |
222 | 206 | plugin_short_name = plugin_full_name.replace("minimal-pba-cli-plugin-", "") |
223 | 207 |
|
224 | 208 | table.add_row( |
225 | | - f"[link=https://capstan-backstage.prod.cirrostratus.org/catalog/default/component/{plugin_full_name}]{plugin_short_name}[/link]", |
| 209 | + f"[link=https://pypi.org/project/{plugin_full_name}]{plugin_short_name}[/link]", |
226 | 210 | plugin["summary"], |
227 | 211 | str(plugin_latest_version), |
228 | 212 | output, |
|
0 commit comments