From da5ad3b5cb9a2e6905aa024426d165613f1d8da0 Mon Sep 17 00:00:00 2001 From: Astronand Date: Fri, 16 Jan 2026 18:52:14 -0500 Subject: [PATCH] bashex --- Src/Hyperion-bash-v1.0.0/bin/bashex | 79 +++++++++++++++++++++++++++++ 1 file changed, 79 insertions(+) create mode 100644 Src/Hyperion-bash-v1.0.0/bin/bashex diff --git a/Src/Hyperion-bash-v1.0.0/bin/bashex b/Src/Hyperion-bash-v1.0.0/bin/bashex new file mode 100644 index 0000000..89a8c26 --- /dev/null +++ b/Src/Hyperion-bash-v1.0.0/bin/bashex @@ -0,0 +1,79 @@ +--:Minify:-- +syscall.TTY_clear() +syscall.TTY_setTextColor(1) +syscall.TTY_setCursorPos(1, 1) +syscall.TTY_print("HyperionOS Bash Shell") +local str="" +local stopInput=false +local inputIO=syscall.IO_getBoundQueue() +local pid=syscall.HPV_getPid() +local proc=0 +local fs=require("sys.fs") +printInline("> ") +while true do + local event = {syscall.IO_pullEvent()} + if event[1] then + if not stopInput then + if event[1]=="keyTyped" then + if event[3]=="\b" then + if #str>0 then + str=str:sub(1,#str-1) + printInline("\b") + end + elseif event[3]=="\n" then + print("") + stopInput=true + if str == "" then + printInline("> ") + stopInput=false + else + local path=nil + if fs.exists("/bin/"..str) then + path="/bin/"..str + elseif fs.exists("/bin/"..str..".lua") then + path="/bin/"..str..".lua" + end + if not path then + print("Program not found") + printInline("> ") + stopInput=false + else + local text = fs.readAllText(path) + local program, err = load(text, path) + if not program then + print(err) + printInline("> ") + end + syscall.IO_bind("bash:"..tostring(pid)) + proc = syscall.HPV_spawn(program, path) + syscall.IO_bind(inputIO) + end + str="" + end + else + str=str..event[3] + printInline(event[3]) + end + end + end + end + if stopInput then + local exited, code = syscall.HPV_collect(proc) + if exited then + print("\nTask exited with code:\n"..tostring(code)) + printInline("> ") + stopInput=false + else + if event[1] then + if event[1]=="keyTyped" and event[3]=="^c" then + syscall.HPV_kill(proc) + print("Terminated") + printInline("> ") + stopInput=false + else + syscall.IO_pushEvent("bash:"..tostring(pid), table.unpack(event)) + end + end + end + end +end \ No newline at end of file