#16 multiline shell commands #17 _ scope (global vs local) #18 path expansion (~) #19 nested commands trigger prompt2 #20 simplify backtick return value #21 prompt redesign #22 implicit interactive commands (drop ! prefix) #23 general cleanup and refactor
22 lines
922 B
Markdown
22 lines
922 B
Markdown
# 22 — Implicit interactive commands (drop `!` prefix)
|
|
|
|
**Status:** open
|
|
|
|
In the REPL, maybe we can get away with not needing the `!` prefix.
|
|
|
|
Lua already attempts to run input as a statement. If that fails, it assumes it might be an expression (e.g. `1 + 2`) and wraps it in `return(...)`. If *that* also fails, we could try wrapping it with `!` prefix semantics as a third fallback.
|
|
|
|
## Execution order
|
|
|
|
1. Try as Lua statement
|
|
2. Try as Lua expression (`return ...`)
|
|
3. Try as shell command (interactive execution)
|
|
|
|
## Considerations
|
|
|
|
- Ambiguity: `ls` is not valid Lua, so it would fall through to shell — this is the desired behaviour
|
|
- But `print` is valid Lua (it's a value) — so `print` alone wouldn't trigger shell
|
|
- What about `git status`? Not valid Lua, would correctly fall through to shell
|
|
- Error messages: if all three fail, which error do we show?
|
|
- Performance: three parse attempts per input line
|