Every main-menu item leads with its own emoji
Tools gain an icon attribute — menu-only, so result windows and the CLI keep the plain title — and the menu loop composes it into the aligned name lane. Single-codepoint, emoji-presentation glyphs only, so the two-cell width holds across terminals: 💬 Chat, 📻 Channels, 🌍 Map, 👥 Nodes, 📡 Send advert, 🔧 configuration, 🔨 actions, 📋 info, 🎯/👣 the traces, 🎧 Monitor, 📶 TX optimize, 🚪 Quit. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
5027d05943
commit
87d2d10dff
13 files changed
+25
-3
No files matched your search
+8
-3
@@ -322,20 +322,25 @@ async def _menu_loop(ctx: AppContext, session: TuiSession) -> None:
|
||||
# Two aligned columns — tool name, then its muted description — with no header
|
||||
# line: these are commands, not tabular data, so the alignment alone carries it.
|
||||
tools = [tool for tool in all_tools() if tool.menu_visible]
|
||||
name_w = max((cell_len(tool.title or tool.name) for tool in tools), default=0)
|
||||
|
||||
def _label(tool) -> str: # noqa: ANN001 - registry Tool; typed at the source
|
||||
title = tool.title or tool.name
|
||||
return f"{tool.icon} {title}" if tool.icon else title
|
||||
|
||||
name_w = max((cell_len(_label(tool)) for tool in tools), default=0)
|
||||
items: list = []
|
||||
current_category: str | None = None
|
||||
for tool in tools:
|
||||
if tool.category != current_category:
|
||||
current_category = tool.category
|
||||
items.append(Separator(f"── {current_category} ──", style="accent"))
|
||||
label = tool.title or tool.name
|
||||
label = _label(tool)
|
||||
row = Text(label)
|
||||
row.append(" " * (name_w - cell_len(label) + 2))
|
||||
row.append(tool.help, style="muted")
|
||||
items.append(Choice(title=row, value=tool.name))
|
||||
items.append(Separator(" "))
|
||||
items.append(Choice(title="Quit", value="__quit__"))
|
||||
items.append(Choice(title="🚪 Quit", value="__quit__"))
|
||||
|
||||
# Drive the menu list ourselves (rather than via session.select) so it stays on the
|
||||
# stack while the quit dialog floats over it: the confirm is drawn as a centered box
|
||||
|
||||
Reference in new issue
Block a user