UI: Dual-line prompt and inline /query search

Prompt style (all menus):
- Replace bare '>' with '╰─>' connected to the hint bar above
- Hint bar uses Claude CLI style: first letter highlighted in cyan,
  rest dimmed (/search  tags  recommend  ?help  quit)
- Creates a visual dual-line input area similar to Claude Code CLI

Inline search:
- Typing /subdomain at the main prompt immediately searches and
  shows results — no second "enter query" prompt needed
- /  (bare slash) still opens the interactive search prompt
- s  still works as a search alias
- search_tools() now accepts optional query parameter

core.py sub-menus:
- Same dual-line prompt style: hint bar + ╰─>
- Compact hint: ?help  quit  99 back
This commit is contained in:
Hardik Zinzuvadiya 2026-03-15 18:37:20 +05:30
parent 998491e72b
commit 511a651e0a
2 changed files with 38 additions and 24 deletions

14
core.py
View file

@ -169,11 +169,12 @@ class HackingTool:
table.add_row("99", f"Back to {parent.TITLE if parent else 'Main Menu'}")
console.print(table)
console.print(
"[dim] Enter number · [bold cyan]?[/bold cyan] help"
" · [bold cyan]q[/bold cyan] quit[/dim]"
" [dim cyan]?[/dim cyan][dim]help "
"[/dim][dim cyan]q[/dim cyan][dim]uit "
"[/dim][dim cyan]99[/dim cyan][dim] back[/dim]"
)
raw = Prompt.ask("\n[bold cyan]>[/bold cyan]", default="").strip().lower()
raw = Prompt.ask("[bold cyan]╰─>[/bold cyan]", default="").strip().lower()
if not raw:
continue
if raw in ("?", "help"):
@ -390,11 +391,12 @@ class HackingToolsCollection:
table.add_row("99", "", f"Back to {parent.TITLE if parent else 'Main Menu'}", "")
console.print(table)
console.print(
"[dim] Enter number · [bold cyan]?[/bold cyan] help"
" · [bold cyan]q[/bold cyan] quit[/dim]"
" [dim cyan]?[/dim cyan][dim]help "
"[/dim][dim cyan]q[/dim cyan][dim]uit "
"[/dim][dim cyan]99[/dim cyan][dim] back[/dim]"
)
raw = Prompt.ask("\n[bold cyan]>[/bold cyan]", default="").strip().lower()
raw = Prompt.ask("[bold cyan]╰─>[/bold cyan]", default="").strip().lower()
if not raw:
continue
if raw in ("?", "help"):

View file

@ -314,15 +314,14 @@ def build_menu():
f"[magenta]{update_def[2]}[/magenta]"
)
# ── Hint bar ──
# ── Claude-style dual-line prompt area ──
console.print(Rule(style="dim magenta"))
console.print(
" [dim]Enter number · "
"[bold cyan]/[/bold cyan] search · "
"[bold cyan]t[/bold cyan] tags · "
"[bold cyan]r[/bold cyan] recommend · "
"[bold cyan]?[/bold cyan] help · "
"[bold cyan]q[/bold cyan] quit[/dim]\n"
" [dim cyan]/[/dim cyan][dim]search "
"[/dim][dim cyan]t[/dim cyan][dim]ags "
"[/dim][dim cyan]r[/dim cyan][dim]ecommend "
"[/dim][dim cyan]?[/dim cyan][dim]help "
"[/dim][dim cyan]q[/dim cyan][dim]uit[/dim]"
)
@ -528,9 +527,12 @@ def recommend_tools():
pass
def search_tools():
"""Interactive search — user types query, results update, select to jump."""
query = Prompt.ask("[bold cyan]/ Search[/bold cyan]", default="").strip().lower()
def search_tools(query: str | None = None):
"""Search tools — accepts inline query or prompts for one."""
if query is None:
query = Prompt.ask("[bold cyan]/ Search[/bold cyan]", default="").strip().lower()
else:
query = query.lower()
if not query:
return
@ -591,28 +593,38 @@ def interact_menu():
while True:
try:
build_menu()
raw = Prompt.ask("[bold magenta]>[/bold magenta]", default="").strip().lower()
raw = Prompt.ask(
"[bold magenta]╰─>[/bold magenta]", default=""
).strip()
if not raw:
continue
if raw in ("?", "help"):
raw_lower = raw.lower()
if raw_lower in ("?", "help"):
show_help()
continue
if raw.startswith("/") or raw in ("s", "search"):
if raw.startswith("/"):
# Inline search: /subdomain → search immediately
query = raw[1:].strip()
search_tools(query=query if query else None)
continue
if raw_lower in ("s", "search"):
search_tools()
continue
if raw in ("t", "tag", "tags", "filter"):
if raw_lower in ("t", "tag", "tags", "filter"):
filter_by_tag()
continue
if raw in ("r", "rec", "recommend"):
if raw_lower in ("r", "rec", "recommend"):
recommend_tools()
continue
if raw in ("q", "quit", "exit"):
if raw_lower in ("q", "quit", "exit"):
console.print(Panel(
"[bold white on magenta] Goodbye — Come Back Safely [/bold white on magenta]",
box=box.HEAVY, border_style="magenta",
@ -620,9 +632,9 @@ def interact_menu():
break
try:
choice = int(raw)
choice = int(raw_lower)
except ValueError:
console.print("[red]⚠ Invalid input — enter a number, ? for help, or q to quit.[/red]")
console.print("[red]⚠ Invalid input — enter a number, /query to search, or q to quit.[/red]")
Prompt.ask("[dim]Press Enter to continue[/dim]", default="")
continue