made dev files (includeing tern) also fixed differnt keyboard layouts hopefully

This commit is contained in:
2026-02-13 17:01:00 -05:00
parent 33cd291c21
commit 403178c832
26 changed files with 728 additions and 683 deletions

View File

@@ -1,71 +1,79 @@
--:Minify:--
syscall.TTY_clear()
syscall.TTY_setTextColor(1)
syscall.TTY_setCursorPos(1, 1)
syscall.TTY_print("HyperionOS Bash Shell")
syscall.open("/dev/tty/TTY1","r")
syscall.open("/dev/tty/TTY1","w")
syscall.open("/dev/null","r")
syscall.devctl(1,"clear")
syscall.devctl(1,"sfgc",1)
syscall.devctl(1,"spos",1,1)
print("HyperionOS Bash Shell")
local str=""
local stopInput=false
local inputIO=syscall.IO_getBoundQueue()
local pid=syscall.getpid()
local proc=0
local fs=require("sys.fs")
local timeout=false
syscall.setEnviron("SHELL","simpleshell")
printInline("> ")
syscall.sigcatch(function(sig)
if sig==1 then
syscall.kill(proc)
print("Terminated")
printInline("> ")
stopInput=false
end
end)
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")
if not stopInput then
local input=syscall.read(0)
if input then
if input=="\b" then
if #str>0 then
str=str:sub(1,#str-1)
printInline("\b")
end
elseif input=="\n" then
print("")
stopInput=true
if str == "" then
printInline("> ")
stopInput=false
else
local path=nil
local split=string.split(str, " ")
if fs.exists("/bin/"..split[1]) then
path="/bin/"..split[1]
elseif fs.exists("/bin/"..split[1]..".lua") then
path="/bin/"..split[1]..".lua"
end
elseif event[3]=="\n" then
print("")
stopInput=true
if str == "" then
if not path then
print("Program not found")
printInline("> ")
stopInput=false
else
local path=nil
local split=string.split(str, " ")
if fs.exists("/bin/"..split[1]) then
path="/bin/"..split[1]
elseif fs.exists("/bin/"..split[1]..".lua") then
path="/bin/"..split[1]..".lua"
end
if not path then
print("Program not found")
local text = fs.readAllText(path)
local program, err = load(text, path)
if not program then
print(err)
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.spawn(program, path, nil, {table.unpack(split, 2)})
syscall.IO_bind(inputIO)
end
str=""
proc = syscall.spawn(function(...)
syscall.open("/dev/tty/TTY1","r")
syscall.open("/dev/tty/TTY1","w")
syscall.open("/dev/null","r")
program(...)
end, path, nil, {table.unpack(split, 2)})
end
elseif event[1]=="keyTyped" and event[3]=="^d" then
syscall.exit(0)
else
str=str..event[3]
printInline(event[3])
str=""
end
else
str=str..input
printInline(input)
end
timeout=false
else
timeout=true
end
timeout=false
else
timeout=true
end
if stopInput then
local exited, code = syscall.collect(proc)
if exited then
if code then
@@ -73,20 +81,14 @@ while true do
end
printInline("> ")
stopInput=false
else
if event[1] then
if event[1]=="keyTyped" and event[3]=="^c" then
syscall.kill(proc)
print("Terminated")
printInline("> ")
stopInput=false
else
syscall.IO_pushEvent("bash:"..tostring(pid), table.unpack(event))
end
end
end
timeout=true
end
if timeout then
sleep(.05)
if stopInput then
sleep(.5)
else
sleep(.05)
end
end
end