v0.6.0 - Added shell parser, echo command and some other minor tweaks.

This commit is contained in:
TheWahlolly
2025-04-26 12:38:05 +03:00
parent d220b9d648
commit 64a761fdde
7 changed files with 90 additions and 11 deletions
+10 -2
View File
@@ -11,7 +11,7 @@ local filesystem = {}
function filesystem.processPath(path) -- returns the address and absolute path of a filesystem path as well as sanitizing it
checkArg(1, path, "string")
absPath = path:gsub("/+", "/"):gsub("/$", "")
absPath = path:gsub("/+", "/")
local address = nil
if absPath:find("^/mnt/.../") then
address = component.get(path:sub(6,8))
@@ -66,4 +66,12 @@ function filesystem.open(path, mode) -- opens a file and returns its handle
return properHandle
end
return(filesystem)
function filesystem.list(path)
checkArg(1, path, "string")
local address, absPath = filesystem.processPath(path)
if not address then
return false
end
return component.invoke(address, "list", absPath)
end
return(filesystem)
View File
+1 -3
View File
@@ -2,7 +2,6 @@ local event = import("event")
--local keyboard = import("keyboard")
local gpu = component.proxy(component.list("gpu")()) -- replace with component.gpu once implemented
local ocelot = component.proxy(component.list("ocelot")())
_G.termlib = {}
termlib.cursorPosX = 1
termlib.cursorPosY = 1
@@ -41,7 +40,6 @@ gpu.setForeground(defaultForegroundColor)
gpu.setBackground(defaultBackgroundColor)
local function scrollDown()
ocelot.log("scrolling")
if gpu.copy(0,1,width,height,0,-1) then
gpu.set(1,height,string.rep(" ",width))
termlib.cursorPosY=height
@@ -183,7 +181,7 @@ function _G.read()
end
end
termlib.cursorPosX, termlib.cursorPosY = cursorPosX, cursorPosY
if curtext == "" then print(" ", false) else print(curtext, false) end
print(curtext, false)
else
cursorWhite = not cursorWhite
end