Skip to content

Commit bef9c2c

Browse files
mbachorikiamaeroplaneclaude
authored
fix(extensions): show extension ID in list output (#1843)
Display the extension ID below the name in `specify extension list` output. This allows users to easily copy the ID when disambiguation is needed. Fixes #1832 Co-authored-by: iamaeroplane <michal.bachorik@gmail.com> Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 4f81fc2 commit bef9c2c

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

src/specify_cli/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2576,6 +2576,7 @@ def extension_list(
25762576
status_color = "green" if ext["enabled"] else "red"
25772577

25782578
console.print(f" [{status_color}]{status_icon}[/{status_color}] [bold]{ext['name']}[/bold] (v{ext['version']})")
2579+
console.print(f" [dim]{ext['id']}[/dim]")
25792580
console.print(f" {ext['description']}")
25802581
console.print(f" Commands: {ext['command_count']} | Hooks: {ext['hook_count']} | Status: {'Enabled' if ext['enabled'] else 'Disabled'}")
25812582
console.print()

tests/test_extensions.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2337,3 +2337,29 @@ def test_update_failure_rolls_back_registry_hooks_and_commands(self, tmp_path):
23372337

23382338
for cmd_file in command_files:
23392339
assert cmd_file.exists(), f"Expected command file to be restored after rollback: {cmd_file}"
2340+
2341+
2342+
class TestExtensionListCLI:
2343+
"""Test extension list CLI output format."""
2344+
2345+
def test_list_shows_extension_id(self, extension_dir, project_dir):
2346+
"""extension list should display the extension ID."""
2347+
from typer.testing import CliRunner
2348+
from unittest.mock import patch
2349+
from specify_cli import app
2350+
2351+
runner = CliRunner()
2352+
2353+
# Install the extension using the manager
2354+
manager = ExtensionManager(project_dir)
2355+
manager.install_from_directory(extension_dir, "0.1.0", register_commands=False)
2356+
2357+
with patch.object(Path, "cwd", return_value=project_dir):
2358+
result = runner.invoke(app, ["extension", "list"])
2359+
2360+
assert result.exit_code == 0, result.output
2361+
# Verify the extension ID is shown in the output
2362+
assert "test-ext" in result.output
2363+
# Verify name and version are also shown
2364+
assert "Test Extension" in result.output
2365+
assert "1.0.0" in result.output

0 commit comments

Comments
 (0)