mirror of
https://github.com/nushell/nushell
synced 2025-01-06 18:29:02 +00:00
ae9c0fc138
* Fix quoting for command line args * Replace custom quoting with escape_quote_string * Use raw string for now
14 lines
307 B
Rust
14 lines
307 B
Rust
pub fn escape_quote_string(input: &str) -> String {
|
|
let mut output = String::with_capacity(input.len() + 2);
|
|
output.push('"');
|
|
|
|
for c in input.chars() {
|
|
if c == '"' || c == '\\' {
|
|
output.push('\\');
|
|
}
|
|
output.push(c);
|
|
}
|
|
|
|
output.push('"');
|
|
output
|
|
}
|