remove planform and show extension version into client list
This commit is contained in:
+21
-4
@@ -86,6 +86,12 @@ def _print_version(ctx, param, value):
|
||||
ctx.exit()
|
||||
|
||||
|
||||
def _client_display_profile(profile_name: str, sock_path: str) -> str:
|
||||
if profile_name != "default":
|
||||
return profile_name
|
||||
return Path(sock_path).stem or profile_name
|
||||
|
||||
|
||||
@click.group()
|
||||
@click.option(
|
||||
"-V", "--version",
|
||||
@@ -136,14 +142,20 @@ def cmd_clients():
|
||||
|
||||
all_clients = []
|
||||
for profile_name, sock_path in profiles.items():
|
||||
display_profile = _client_display_profile(profile_name, sock_path)
|
||||
try:
|
||||
result = send_command("clients.list", profile=profile_name)
|
||||
for c in (result or []):
|
||||
c.setdefault("profile", profile_name)
|
||||
c["profile"] = display_profile
|
||||
all_clients.append(c)
|
||||
except (BrowserNotConnected, RuntimeError):
|
||||
# Socket registered but browser no longer connected
|
||||
all_clients.append({"profile": profile_name, "name": "—", "version": "—", "platform": "disconnected"})
|
||||
all_clients.append({
|
||||
"profile": display_profile,
|
||||
"name": "—",
|
||||
"version": "—",
|
||||
"extensionVersion": "disconnected",
|
||||
})
|
||||
|
||||
if not all_clients:
|
||||
console.print("[yellow]No browser clients found. Start a browser with the extension enabled first.[/yellow]")
|
||||
@@ -154,9 +166,14 @@ def cmd_clients():
|
||||
table.add_column("Profile")
|
||||
table.add_column("Browser")
|
||||
table.add_column("Version")
|
||||
table.add_column("Platform")
|
||||
table.add_column("Extension Version")
|
||||
for c in all_clients:
|
||||
table.add_row(c.get("profile", ""), c.get("name", ""), c.get("version", ""), c.get("platform", ""))
|
||||
table.add_row(
|
||||
c.get("profile", ""),
|
||||
c.get("name", ""),
|
||||
c.get("version", ""),
|
||||
c.get("extensionVersion", ""),
|
||||
)
|
||||
console.print(table)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user