fix that the cli still used the DEFAULT_SOCKET Const, give better error message when no browser found adding test for client and update cli test, and update version and readme
This commit is contained in:
+3
-5
@@ -124,7 +124,7 @@ main.add_command(search_group)
|
||||
def cmd_clients():
|
||||
"""Show connected browser clients."""
|
||||
import json as _json
|
||||
from browser_cli.client import REGISTRY_PATH, DEFAULT_SOCKET
|
||||
from browser_cli.client import REGISTRY_PATH
|
||||
|
||||
# Build a map of profile → socket path from the registry
|
||||
profiles: dict[str, str] = {}
|
||||
@@ -133,8 +133,6 @@ def cmd_clients():
|
||||
profiles = _json.loads(REGISTRY_PATH.read_text())
|
||||
except Exception:
|
||||
pass
|
||||
if not profiles:
|
||||
profiles = {"default": DEFAULT_SOCKET}
|
||||
|
||||
all_clients = []
|
||||
for profile_name, sock_path in profiles.items():
|
||||
@@ -148,7 +146,7 @@ def cmd_clients():
|
||||
all_clients.append({"profile": profile_name, "name": "—", "version": "—", "platform": "disconnected"})
|
||||
|
||||
if not all_clients:
|
||||
console.print("[yellow]No browser clients found[/yellow]")
|
||||
console.print("[yellow]No browser clients found. Start a browser with the extension enabled first.[/yellow]")
|
||||
sys.exit(1)
|
||||
|
||||
from rich.table import Table
|
||||
@@ -158,7 +156,7 @@ def cmd_clients():
|
||||
table.add_column("Version")
|
||||
table.add_column("Platform")
|
||||
for c in all_clients:
|
||||
table.add_row(c.get("profile", "default"), c.get("name", ""), c.get("version", ""), c.get("platform", ""))
|
||||
table.add_row(c.get("profile", ""), c.get("name", ""), c.get("version", ""), c.get("platform", ""))
|
||||
console.print(table)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user