mirror of
https://github.com/nushell/nushell.git
synced 2025-01-11 08:48:23 +01:00
Fix string interpolation is not working with external command (#3686)
This commit is contained in:
parent
4ed615cfcc
commit
6cdd8a2b07
@ -730,7 +730,9 @@ fn parse_external_arg(
|
|||||||
lite_arg: &Spanned<String>,
|
lite_arg: &Spanned<String>,
|
||||||
scope: &dyn ParserScope,
|
scope: &dyn ParserScope,
|
||||||
) -> (SpannedExpression, Option<ParseError>) {
|
) -> (SpannedExpression, Option<ParseError>) {
|
||||||
if lite_arg.item.starts_with('$') || lite_arg.item.starts_with('(') {
|
if lite_arg.item.starts_with('$') {
|
||||||
|
parse_dollar_expr(lite_arg, scope)
|
||||||
|
} else if lite_arg.item.starts_with('(') {
|
||||||
parse_full_column_path(lite_arg, scope)
|
parse_full_column_path(lite_arg, scope)
|
||||||
} else {
|
} else {
|
||||||
(
|
(
|
||||||
|
@ -368,4 +368,25 @@ mod external_command_arguments {
|
|||||||
},
|
},
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn string_interpolation_with_an_external_command() {
|
||||||
|
Playground::setup(
|
||||||
|
"string_interpolation_with_an_external_command",
|
||||||
|
|dirs, sandbox| {
|
||||||
|
sandbox.mkdir("cd");
|
||||||
|
|
||||||
|
sandbox.with_files(vec![EmptyFile("cd/jonathan_likes_cake.txt")]);
|
||||||
|
|
||||||
|
let actual = nu!(
|
||||||
|
cwd: dirs.test(), pipeline(
|
||||||
|
r#"
|
||||||
|
^ls $"(pwd)/cd"
|
||||||
|
"#
|
||||||
|
));
|
||||||
|
|
||||||
|
assert_eq!(actual.out, "jonathan_likes_cake.txt");
|
||||||
|
},
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user