r/lua • u/Pristine_Video2489 • 6h ago
Project wisp v3.1.0 – A Linux shell in C++17 with Lua 5.4 for scripting, config, and typed pipelines
I just released wisp v3.1.0, a fast POSIX-style Linux shell written in C++17 (2,864 LOC, 344 KB stripped binary, ~0.55 ms startup) that embeds Lua 5.4 as its scripting, configuration, and pipeline language instead of a bespoke shell DSL.
Repo: https://github.com/Hinikaa/wisp
How Lua integrates into wisp
- Global Lua functions become shell commands: Any global function defined in
~/.config/wisp/init.luacan be called directly at the prompt (hello world) with no alias wrapper syntax. - In-process structured pipelines: Consecutive Lua-function or builtin stages pass Lua values (tables, strings, numbers, booleans) directly from one stage's return value to the next without forking or text parsing. Only when a pipeline crosses into an external binary (
grep,wc, etc.) doeswispfork and serialize at that boundary. - Inline Lua & script modes: Prefix any prompt or
-cline with:for inline Lua (:1 + 1, with>>>multi-line continuation), use-efor one-liners, or-f script.lua/#!/usr/bin/env wispfor standalone scripts. - Prompt customization & tab completion: Define
function prompt()ininit.lua, and get tab completion for files,~/, builtins, and dotted Lua tables (e.g.:string.up<Tab>) via vendoredlinenoise.
In ~/.config/wisp/init.lua:
-- ~/.config/wisp/init.lua
function nums(input)
return { {n = 3}, {n = 1}, {n = 2} }
end
function sorted(input)
table.sort(input, function(a, b) return a.n < b.n end)
return input
endAnd at the prompt:
wisp> nums | sorted
n=1
n=2
n=3
wisp> nums | sorted | wc -lWhat's new in v3.1.0
- Fixed filename tab-completion prefix bugs, added
~/expansion, empty-base hidden-file filtering, and dotted Lua table completion - Fixed
wisp -c/-fCPU spin in non-foreground TTYs andSIGPIPEcrashes on native-to-external pipes - Added 3-state quoting protection so
"*.cpp"and\*.cppsuppress globbing while"$VAR"still expands - Replaced startup
luaL_dostringwith direct Lua C APIpackage.path/package.cpathupdates, plus a self-containedbootstrap.luabuild/test script alongsideMakefile
Feedback and bug reports are welcome!