feat: allow using line continuations in templates

This commit is contained in:
iff 2023-08-11 15:29:10 +02:00
parent a193a86a5f
commit 498a134da3
4 changed files with 8 additions and 11 deletions

View file

@ -123,7 +123,7 @@ fn eval_shell_command(shell: &str, command: &str) -> Vec<String> {
pub fn split_command(command: &str) -> Vec<String> {
// this regex splits the command separated by spaces, except when the space
// is escaped by a backslash or surrounded by quotes
let regex = r#"([^\s"'\\]+|"(?:\\.|[^"\\])*"|\\\s+|'(?:\\.|[^'\\])*'|\\\s)+"#;
let regex = r#"([^\s"'\\]+|"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\\ )+|\\|\n"#;
let regex = Regex::new(regex).unwrap();
let split_command = regex
.find_iter(command)