fix: clean up tools --summary output and type annotations
- Use Optional[List[str]] instead of List[str] | None (consistency) - Add header, per-platform counts, and checkmark list format - Matches the visual style of the interactive configurator
This commit is contained in:
parent
3a2fd1a5c9
commit
331af8df23
1 changed files with 11 additions and 9 deletions
|
|
@ -11,7 +11,7 @@ the `platform_toolsets` key.
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import Dict, List, Set
|
from typing import Dict, List, Optional, Set
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
|
||||||
|
|
@ -308,7 +308,7 @@ def _get_enabled_platforms() -> List[str]:
|
||||||
return enabled
|
return enabled
|
||||||
|
|
||||||
|
|
||||||
def _platform_toolset_summary(config: dict, platforms: List[str] | None = None) -> Dict[str, Set[str]]:
|
def _platform_toolset_summary(config: dict, platforms: Optional[List[str]] = None) -> Dict[str, Set[str]]:
|
||||||
"""Return a summary of enabled toolsets per platform.
|
"""Return a summary of enabled toolsets per platform.
|
||||||
|
|
||||||
When ``platforms`` is None, this uses ``_get_enabled_platforms`` to
|
When ``platforms`` is None, this uses ``_get_enabled_platforms`` to
|
||||||
|
|
@ -893,19 +893,21 @@ def tools_command(args=None, first_install: bool = False, config: dict = None):
|
||||||
|
|
||||||
# Non-interactive summary mode for CLI usage
|
# Non-interactive summary mode for CLI usage
|
||||||
if getattr(args, "summary", False):
|
if getattr(args, "summary", False):
|
||||||
|
total = len(CONFIGURABLE_TOOLSETS)
|
||||||
|
print(color("⚕ Tool Summary", Colors.CYAN, Colors.BOLD))
|
||||||
|
print()
|
||||||
summary = _platform_toolset_summary(config, enabled_platforms)
|
summary = _platform_toolset_summary(config, enabled_platforms)
|
||||||
for pkey in enabled_platforms:
|
for pkey in enabled_platforms:
|
||||||
pinfo = PLATFORMS[pkey]
|
pinfo = PLATFORMS[pkey]
|
||||||
enabled = summary.get(pkey, set())
|
enabled = summary.get(pkey, set())
|
||||||
if not enabled:
|
count = len(enabled)
|
||||||
enabled_label = "none"
|
print(color(f" {pinfo['label']}", Colors.BOLD) + color(f" ({count}/{total})", Colors.DIM))
|
||||||
else:
|
if enabled:
|
||||||
labels = []
|
|
||||||
for ts_key in sorted(enabled):
|
for ts_key in sorted(enabled):
|
||||||
label = next((l for k, l, _ in CONFIGURABLE_TOOLSETS if k == ts_key), ts_key)
|
label = next((l for k, l, _ in CONFIGURABLE_TOOLSETS if k == ts_key), ts_key)
|
||||||
labels.append(label)
|
print(color(f" ✓ {label}", Colors.GREEN))
|
||||||
enabled_label = ", ".join(labels)
|
else:
|
||||||
print(color(f"- {pinfo['label']}: {enabled_label}", Colors.DIM))
|
print(color(" (none enabled)", Colors.DIM))
|
||||||
print()
|
print()
|
||||||
return
|
return
|
||||||
print(color("⚕ Hermes Tool Configuration", Colors.CYAN, Colors.BOLD))
|
print(color("⚕ Hermes Tool Configuration", Colors.CYAN, Colors.BOLD))
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue