-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhelp.py
More file actions
54 lines (45 loc) · 1.85 KB
/
Copy pathhelp.py
File metadata and controls
54 lines (45 loc) · 1.85 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
"""
help.py - Banner and command/help menu utilities for CLI
"""
from rich import print as rprint
BANNER = (
"[bold cyan]╔═════════════════════════════════════════════════════════╗\n"
"║ LoreBuilder CLI - World Builder ║\n"
"╚═════════════════════════════════════════════════════════╝[/bold cyan]"
)
LORE_COMMANDS = [
"add_lore", "generate_lore", "store_generated_lore", "query_lore", "list_all_lore", "delete_lore"
]
CHAR_COMMANDS = [
"chat_as"
]
SYSTEM_COMMANDS = ["help", "exit"]
def print_banner():
"""
Prints the application banner/logo.
"""
rprint(BANNER)
def print_command_menu(commands_registry=None):
"""
Prints out the available commands by category.
Descriptions are sourced from command docstrings if present.
"""
rprint("[bold cyan]Available Commands:[/bold cyan]")
rprint("[cyan]Lore: [white]add_lore, generate_lore, store_generated_lore, query_lore, list_all_lore, delete_lore")
rprint("[cyan]Characters: [white]chat_as <character> <message>")
rprint("[cyan]System: [white]help, exit")
if commands_registry:
rprint("\n[dim]Type 'help <command>' for usage if available.[/dim]")
def print_command_help(command, commands_registry):
"""
Prints detailed help for a single command, if available.
"""
handler = commands_registry.get(command)
if not handler:
rprint(f"[red]No such command: {command}")
return
doc = handler.__doc__
if doc:
rprint(f"[cyan]Help for '[bold]{command}[/bold]':\n{doc.strip()}")
else:
rprint(f"[grey]No help available for command: {command}")