Skip to main content

split_command

Function split_command 

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

Split a command line the way redis-cli does (its sdssplitargs): whitespace separates arguments; "…" quotes allow \n \r \t \b \a \\ \" and \xHH; '…' quotes allow \'; a closing quote must be followed by whitespace or the end.

So SET greeting "hello world" is three arguments, not four with stray quotes — which is what the model writes, because it is what redis-cli accepts. Unbalanced quotes are an error rather than a guess.