mirror of
https://github.com/nushell/nushell.git
synced 2025-08-09 12:55:47 +02:00
Fix quoting for command line args (#5384)
* Fix quoting for command line args * Replace custom quoting with escape_quote_string * Use raw string for now
This commit is contained in:
14
crates/nu-parser/src/deparse.rs
Normal file
14
crates/nu-parser/src/deparse.rs
Normal file
@ -0,0 +1,14 @@
|
||||
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
|
||||
}
|
@ -1,3 +1,4 @@
|
||||
mod deparse;
|
||||
mod errors;
|
||||
mod flatten;
|
||||
mod known_external;
|
||||
@ -7,6 +8,7 @@ mod parse_keywords;
|
||||
mod parser;
|
||||
mod type_check;
|
||||
|
||||
pub use deparse::escape_quote_string;
|
||||
pub use errors::ParseError;
|
||||
pub use flatten::{flatten_block, flatten_expression, flatten_pipeline, FlatShape};
|
||||
pub use known_external::KnownExternal;
|
||||
|
Reference in New Issue
Block a user