Fixing the flag issue (#5447)

* Fixing the flag issue

* whoops, forgot the original point of the function

* Update deparse.rs

* Update deparse.rs

* Update deparse.rs

* maybe this might work

* fmt

* quotation marks works now due to a rigorous check for args.

* fmt and clippy

* kept the original escape_quote_string(), escaped " and \

* removed script.nu

* Added appropriate comments.
This commit is contained in:
pwygab
2022-05-09 20:01:58 +08:00
committed by GitHub
parent 7ee22603ac
commit 8d8f25b210
3 changed files with 98 additions and 3 deletions

View File

@@ -17,7 +17,7 @@ use nu_cli::{
};
use nu_command::{create_default_context, BufferedReader};
use nu_engine::{get_full_help, CallExt};
use nu_parser::{escape_quote_string, parse};
use nu_parser::{escape_quote_string, escape_quote_string_with_file, parse};
use nu_protocol::{
ast::{Call, Expr, Expression},
engine::{Command, EngineState, Stack, StateWorkingSet},
@@ -82,7 +82,7 @@ fn main() -> Result<()> {
let mut args = std::env::args().skip(1);
while let Some(arg) = args.next() {
if !script_name.is_empty() {
args_to_script.push(escape_quote_string(&arg));
args_to_script.push(escape_quote_string_with_file(&arg, &script_name));
} else if arg.starts_with('-') {
// Cool, it's a flag
let flag_value = match arg.as_ref() {