mirror of
https://github.com/fish-shell/fish-shell.git
synced 2025-03-27 14:45:13 +08:00
Add hint to error message about cmdsub in command position
We might end up allowing this but let's add some help for now. See #5575
This commit is contained in:
parent
366b3f21c6
commit
7df70e18f4
@ -1347,7 +1347,7 @@ impl<'a, 'b, 'c> Expander<'a, 'b, 'c> {
|
|||||||
self.errors,
|
self.errors,
|
||||||
start,
|
start,
|
||||||
end,
|
end,
|
||||||
"command substitutions not allowed here"
|
"command substitutions not allowed in command position. Try var=(your-cmd) $var ..."
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return ExpandResult::make_error(STATUS_EXPAND_ERROR.unwrap());
|
return ExpandResult::make_error(STATUS_EXPAND_ERROR.unwrap());
|
||||||
|
@ -325,7 +325,7 @@ $fish -c 'echo {}}'
|
|||||||
#CHECKERR: echo {}}
|
#CHECKERR: echo {}}
|
||||||
#CHECKERR: ^
|
#CHECKERR: ^
|
||||||
printf '<%s>\n' ($fish -c 'command (asd)' 2>&1)
|
printf '<%s>\n' ($fish -c 'command (asd)' 2>&1)
|
||||||
#CHECK: <fish: command substitutions not allowed here>
|
#CHECK: <fish: command substitutions not allowed in command position. Try var=(your-cmd) $var ...>
|
||||||
#CHECK: <command (asd)>
|
#CHECK: <command (asd)>
|
||||||
#CHECK: < ^~~~^>
|
#CHECK: < ^~~~^>
|
||||||
true
|
true
|
||||||
|
@ -25,7 +25,7 @@ FOO=BAR (true one)
|
|||||||
# more things
|
# more things
|
||||||
' | $fish 2>| string replace -r '(.*)' '<$1>'
|
' | $fish 2>| string replace -r '(.*)' '<$1>'
|
||||||
|
|
||||||
# CHECK: <fish: command substitutions not allowed here>
|
# CHECK: <fish: command substitutions not allowed in command position. Try var=(your-cmd) $var ...>
|
||||||
# CHECK: <FOO=BAR (true one)>
|
# CHECK: <FOO=BAR (true one)>
|
||||||
# CHECK: < ^~~~~~~~~^>
|
# CHECK: < ^~~~~~~~~^>
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user