MCPcopy Create free account
hub / github.com/ChrisFeldmeier/OpenCodeRust / parse

Method parse

crates/opencode-command/src/lib.rs:152–170  ·  view source on GitHub ↗
(&self, input: &str)

Source from the content-addressed store, hash-verified

150 }
151
152 pub fn parse(&self, input: &str) -> Option<(&Command, Vec<String>)> {
153 let input = input.trim_start();
154
155 if !input.starts_with('/') {
156 return None;
157 }
158
159 let input = &input[1..];
160 let parts: Vec<&str> = input.split_whitespace().collect();
161
162 if parts.is_empty() {
163 return None;
164 }
165
166 let name = parts[0];
167 let args: Vec<String> = parts[1..].iter().map(|s| s.to_string()).collect();
168
169 self.commands.get(name).map(|cmd| (cmd, args))
170 }
171
172 /// Execute a command and return the rendered template
173 pub fn execute(&self, name: &str, ctx: CommandContext) -> anyhow::Result<String> {

Callers 11

readMessageFunction · 0.45
read_raw_messageMethod · 0.45
sign_requestMethod · 0.45
build_headersMethod · 0.45
receiveMethod · 0.45
resolve_command_templateFunction · 0.45
extract_line_rangeFunction · 0.45
parse_hunk_startMethod · 0.45
test_parse_commandFunction · 0.45
parse_bash_commandFunction · 0.45
parse_multi_file_patchFunction · 0.45

Calls 2

is_emptyMethod · 0.80
getMethod · 0.45

Tested by 1

test_parse_commandFunction · 0.36