mirror of
https://github.com/nushell/nushell.git
synced 2025-06-30 22:50:14 +02:00
Don't expanding globs if user pass variables. (#11946)
# Description Fixes: #11912 # User-Facing Changes After this change: ``` let x = '*.nu'; ^echo $x ``` will no longer expand glob. If users still want to expand glob, there are also 3 ways to do this: ``` # 1. use spread operation with `glob` command let x = '*.nu'; ^echo ...(glob $x) ``` # Tests + Formatting Done # After Submitting NaN
This commit is contained in:
@ -711,9 +711,11 @@ fn trim_expand_and_apply_arg(
|
||||
// if arg is quoted, like "aa", 'aa', `aa`, or:
|
||||
// if arg is a variable or String interpolation, like: $variable_name, $"($variable_name)"
|
||||
// `as_a_whole` will be true, so nu won't remove the inner quotes.
|
||||
let (trimmed_args, run_glob_expansion, mut keep_raw) = trim_enclosing_quotes(&arg.item);
|
||||
let (trimmed_args, mut run_glob_expansion, mut keep_raw) = trim_enclosing_quotes(&arg.item);
|
||||
if *arg_keep_raw {
|
||||
keep_raw = true;
|
||||
// it's a list or a variable, don't run glob expansion either
|
||||
run_glob_expansion = false;
|
||||
}
|
||||
let mut arg = Spanned {
|
||||
item: if keep_raw {
|
||||
|
Reference in New Issue
Block a user