Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/specify_cli/integrations/catalog/command_remove.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@


import typer
from rich.markup import escape as _rich_escape

from ..._console import console
from . import catalog_app
Expand All @@ -25,4 +26,5 @@ def integration_catalog_remove(
console.print(f"[red]Error:[/red] {exc}")
raise typer.Exit(1)

console.print(f"[green]✓[/green] Catalog source '{removed_name}' removed")
safe_name = _rich_escape(removed_name)
console.print(f"[green]✓[/green] Catalog source '{safe_name}' removed")
3 changes: 2 additions & 1 deletion src/specify_cli/workflows/catalog/command_remove.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,5 @@ def workflow_catalog_remove(
cli.console.print(f"[red]Error:[/red] {exc}")
raise cli.typer.Exit(1)

cli.console.print(f"[green]✓[/green] Catalog source '{removed_name}' removed")
safe_name = cli._escape_markup(removed_name)
cli.console.print(f"[green]✓[/green] Catalog source '{safe_name}' removed")
3 changes: 2 additions & 1 deletion src/specify_cli/workflows/step/catalog/command_remove.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,5 @@ def workflow_step_catalog_remove(
cli.console.print(f"[red]Error:[/red] {exc}")
raise cli.typer.Exit(1)

cli.console.print(f"[green]✓[/green] Step catalog source '{removed_name}' removed")
safe_name = cli._escape_markup(removed_name)
cli.console.print(f"[green]✓[/green] Step catalog source '{safe_name}' removed")
24 changes: 24 additions & 0 deletions tests/specify_cli/integrations/catalog/test_command_remove.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,30 @@ def test_catalog_remove_out_of_range(self, tmp_path, monkeypatch):
assert result.exit_code == 1
assert "out of range" in result.output

def test_catalog_remove_prints_bracketed_name_literally(
self, tmp_path, monkeypatch
):
project = self._make_project(tmp_path)
monkeypatch.delenv("SPECKIT_INTEGRATION_CATALOG_URL", raising=False)
add = self._invoke(
[
"integration",
"catalog",
"add",
"https://only.example.com/catalog.json",
"--name",
"QA [/beta]",
],
project,
)
assert add.exit_code == 0, add.output

remove = self._invoke(
["integration", "catalog", "remove", "0"], project
)
assert remove.exit_code == 0, remove.output
assert "'QA [/beta]' removed" in remove.output

def test_catalog_remove_without_config(self, tmp_path, monkeypatch):
project = self._make_project(tmp_path)
result = self._invoke(
Expand Down
14 changes: 14 additions & 0 deletions tests/specify_cli/workflows/catalog/test_command_remove.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,20 @@ def test_workflow_catalog_remove_deletes_selected_source(project_dir, monkeypatc
)


def test_workflow_catalog_remove_prints_bracketed_name_literally(
project_dir, monkeypatch
):
monkeypatch.chdir(project_dir)
monkeypatch.delenv("SPECKIT_WORKFLOW_CATALOG_URL", raising=False)
catalog = WorkflowCatalog(project_dir)
catalog.add_catalog("https://example.com/workflows.json", "QA [/beta]")

result = CliRunner().invoke(app, ["workflow", "catalog", "remove", "0"])

assert result.exit_code == 0, result.output
assert "'QA [/beta]' removed" in result.output


def test_workflow_catalog_remove_uses_listed_index(project_dir, monkeypatch):
monkeypatch.chdir(project_dir)
monkeypatch.delenv("SPECKIT_WORKFLOW_CATALOG_URL", raising=False)
Expand Down
16 changes: 16 additions & 0 deletions tests/specify_cli/workflows/step/catalog/test_command_remove.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,22 @@ def test_workflow_step_catalog_remove_deletes_selected_source(
)


def test_workflow_step_catalog_remove_prints_bracketed_name_literally(
project_dir, monkeypatch
):
monkeypatch.chdir(project_dir)
monkeypatch.delenv("SPECKIT_STEP_CATALOG_URL", raising=False)
catalog = StepCatalog(project_dir)
catalog.add_catalog("https://example.com/steps.json", "QA [/beta]")

result = CliRunner().invoke(
app, ["workflow", "step", "catalog", "remove", "0"]
)

assert result.exit_code == 0, result.output
assert "'QA [/beta]' removed" in result.output


def test_workflow_step_catalog_remove_uses_listed_index(project_dir, monkeypatch):
monkeypatch.chdir(project_dir)
monkeypatch.delenv("SPECKIT_STEP_CATALOG_URL", raising=False)
Expand Down
Loading