1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-10-17 13:52:28 +00:00

Shell: Show a snippet of what caused the error (if possible)

Now we can have nice errors too:
```
Shell: Glob did not match anything!
  0| echo ?x
~~~~~~~~~~^^
  1|

```
This commit is contained in:
AnotherTest 2021-01-03 12:38:20 +03:30 committed by Andreas Kling
parent 3d51bcaa4e
commit a698af88fc
4 changed files with 165 additions and 25 deletions

View file

@ -866,10 +866,12 @@ bool Shell::run_builtin(const AST::Command& command, const NonnullRefPtrVector<A
Core::EventLoop loop;
setup_signals();
#define __ENUMERATE_SHELL_BUILTIN(builtin) \
if (name == #builtin) { \
retval = builtin_##builtin(argv.size() - 1, argv.data()); \
return true; \
#define __ENUMERATE_SHELL_BUILTIN(builtin) \
if (name == #builtin) { \
retval = builtin_##builtin(argv.size() - 1, argv.data()); \
if (!has_error(ShellError::None)) \
raise_error(m_error, m_error_description, command.position); \
return true; \
}
ENUMERATE_SHELL_BUILTINS();