MCPcopy Create free account
hub / github.com/Louisym/MiniCC / parse_slash_command

Function parse_slash_command

mini_claude_code/main.py:75–95  ·  view source on GitHub ↗

源码: app.rs:52-69 (SlashCommand::parse) 返回 (command, optional_arg) 或 None (不是 slash command)。

(input_text: str)

Source from the content-addressed store, hash-verified

73
74
75def parse_slash_command(input_text: str) -> Optional[tuple[SlashCommand, Optional[str]]]:
76 """源码: app.rs:52-69 (SlashCommand::parse)
77
78 返回 (command, optional_arg) 或 None (不是 slash command)。
79 """
80 trimmed = input_text.strip()
81 if not trimmed.startswith("/"):
82 return None
83
84 parts = trimmed[1:].split(None, 1)
85 cmd = parts[0].lower() if parts else ""
86 arg = parts[1] if len(parts) > 1 else None
87
88 mapping = {
89 "help": SlashCommand.HELP,
90 "status": SlashCommand.STATUS,
91 "compact": SlashCommand.COMPACT,
92 "exit": SlashCommand.EXIT,
93 "quit": SlashCommand.EXIT,
94 }
95 return (mapping.get(cmd, SlashCommand.UNKNOWN), arg)
96
97
98# ============================================================

Callers 1

run_replFunction · 0.85

Calls 1

getMethod · 0.45

Tested by

no test coverage detected