MCPcopy Create free account
hub / github.com/clockworklabs/SpacetimeDB / split_command_string

Function split_command_string

crates/testing/src/sdk.rs:299–329  ·  view source on GitHub ↗
(command: &str)

Source from the content-addressed store, hash-verified

297}
298
299fn split_command_string(command: &str) -> (String, Vec<String>) {
300 let mut parts = Vec::new();
301 let mut current = String::new();
302 let mut in_quotes = false;
303 let mut quote_char = '\0';
304
305 for c in command.chars() {
306 match c {
307 '"' | '\'' if !in_quotes => {
308 in_quotes = true;
309 quote_char = c;
310 }
311 '"' | '\'' if in_quotes && c == quote_char => {
312 in_quotes = false;
313 }
314 ' ' if !in_quotes => {
315 if !current.is_empty() {
316 parts.push(std::mem::take(&mut current));
317 }
318 }
319 _ => current.push(c),
320 }
321 }
322 if !current.is_empty() {
323 parts.push(current);
324 }
325
326 let mut iter = parts.into_iter();
327 let exe = iter.next().expect("Command should have at least a program name");
328 (exe, iter.collect())
329}
330
331// Note: this function is memoized to ensure we only compile each client once.
332fn compile_client(compile_command: &str, client_project: &str) {

Callers 1

run_clientFunction · 0.85

Calls 7

takeFunction · 0.85
newFunction · 0.50
is_emptyMethod · 0.45
pushMethod · 0.45
into_iterMethod · 0.45
nextMethod · 0.45
collectMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…