Skip to content

Commit 82dda14

Browse files
iamaeroplaneclaude
andcommitted
fix(extensions): properly detect ambiguous names in extension_info
The extension_info command was breaking on the first name match without checking for ambiguity. This fix separates ID matching from name matching and checks for ambiguity before selecting a match, consistent with the _resolve_installed_extension() helper used by other commands. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent df46cf6 commit 82dda14

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/specify_cli/__init__.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2436,16 +2436,21 @@ def extension_info(
24362436
# Try to resolve from installed extensions first (by ID or name)
24372437
resolved_installed_id = None
24382438
resolved_installed_name = None
2439+
2440+
# First check for exact ID match
24392441
for ext in installed:
2440-
if ext["id"] == extension or ext["name"].lower() == extension.lower():
2442+
if ext["id"] == extension:
24412443
resolved_installed_id = ext["id"]
24422444
resolved_installed_name = ext["name"]
24432445
break
24442446

2445-
# Check for ambiguous installed name matches
2447+
# If no ID match, check for name matches (with ambiguity detection)
24462448
if not resolved_installed_id:
24472449
name_matches = [ext for ext in installed if ext["name"].lower() == extension.lower()]
2448-
if len(name_matches) > 1:
2450+
if len(name_matches) == 1:
2451+
resolved_installed_id = name_matches[0]["id"]
2452+
resolved_installed_name = name_matches[0]["name"]
2453+
elif len(name_matches) > 1:
24492454
from rich.table import Table
24502455
console.print(
24512456
f"[red]Error:[/red] Extension name '{extension}' is ambiguous. "

0 commit comments

Comments
 (0)