mirror of
https://github.com/fish-shell/fish-shell.git
synced 2024-11-25 09:39:52 +08:00
Point to builtins begin/end when a failed command starts with "{"
Closes #6415
This commit is contained in:
parent
565a7e4bc5
commit
48c1550f61
|
@ -55,6 +55,7 @@ Interactive improvements
|
||||||
- The Web-based configuration and documentation now feature a dark mode if the browser requests it (:issue:`8043`).
|
- The Web-based configuration and documentation now feature a dark mode if the browser requests it (:issue:`8043`).
|
||||||
- Color variables can now also be given like ``--background red`` and ``-b red``, not just ``--background=red`` (:issue:`8053`).
|
- Color variables can now also be given like ``--background red`` and ``-b red``, not just ``--background=red`` (:issue:`8053`).
|
||||||
- ``exit`` run within ``fish_prompt`` now exits properly (:issue:`8033`).
|
- ``exit`` run within ``fish_prompt`` now exits properly (:issue:`8033`).
|
||||||
|
- When attempting to execute the unsupported POSIX-style brace command group (``{ ... }``) fish will suggest its equivalent ``begin; ...; end`` commands (:issue:`6415`).
|
||||||
|
|
||||||
New or improved bindings
|
New or improved bindings
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
|
@ -279,4 +279,8 @@ enum class pipeline_position_t {
|
||||||
#define ERROR_TIME_BACKGROUND \
|
#define ERROR_TIME_BACKGROUND \
|
||||||
_(L"'time' is not supported for background jobs. Consider using 'command time'.")
|
_(L"'time' is not supported for background jobs. Consider using 'command time'.")
|
||||||
|
|
||||||
|
/// Error issued on { echo; echo }.
|
||||||
|
#define ERROR_NO_BRACE_GROUPING \
|
||||||
|
_(L"'{ ... }' is not supported for grouping commands. Please use 'begin; ...; end'")
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -779,6 +779,10 @@ end_execution_reason_t parse_execution_context_t::handle_command_not_found(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!cmd_str.empty() && cmd_str.at(0) == L'{') {
|
||||||
|
error.append(ERROR_NO_BRACE_GROUPING);
|
||||||
|
}
|
||||||
|
|
||||||
// Here we want to report an error (so it shows a backtrace).
|
// Here we want to report an error (so it shows a backtrace).
|
||||||
// If the handler printed text, that's already shown, so error will be empty.
|
// If the handler printed text, that's already shown, so error will be empty.
|
||||||
return this->report_error(STATUS_CMD_UNKNOWN, statement, error.c_str());
|
return this->report_error(STATUS_CMD_UNKNOWN, statement, error.c_str());
|
||||||
|
|
|
@ -21,4 +21,10 @@ $fish -C 'functions --erase fish_command_not_found' -c 'nonexistent-command appl
|
||||||
#CHECKERR: nonexistent-command apple friday
|
#CHECKERR: nonexistent-command apple friday
|
||||||
#CHECKERR: ^
|
#CHECKERR: ^
|
||||||
|
|
||||||
|
{ echo; echo }
|
||||||
|
# CHECKERR: {{.*}}: Unknown command: '{ echo; echo }'
|
||||||
|
# CHECKERR: {{.*}}: '{ ... }' is not supported for grouping commands. Please use 'begin; ...; end'
|
||||||
|
# CHECKERR: { echo; echo }
|
||||||
|
# CHECKERR: ^
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
|
|
Loading…
Reference in New Issue
Block a user