Skip to main content

split_command

Function split_command 

Source
pub fn split_command(cmd: &str) -> Result<Vec<String>>
Expand description

Split a shell-like command string into argv parts.

Supports quotes and backslash escapes (e.g. cmd --flag "a b").

§Example

let argv = split_command("echo 'hello world'")?;
assert_eq!(argv, vec!["echo", "hello world"]);

§Errors

Returns an error if the command string has unmatched quotes.