v1.0.0 - Added Argentum as well as other major improvements and bugfixes.

This commit is contained in:
TheWahlolly
2025-05-18 19:16:30 +03:00
parent 521d52a26e
commit 95c235e65b
19 changed files with 951 additions and 42 deletions
+1 -1
View File
@@ -1,7 +1,7 @@
local loadfile = ...
local filesystem = loadfile("/halyde/lib/filesystem.lua")(loadfile)
_G._OSVERSION = "Halyde 0.10.1"
_G._OSVERSION = "Halyde 1.0.0"
function _G.import(module, ...)
local args = table.pack(...)
+7 -7
View File
@@ -1,7 +1,7 @@
local shellcfg = import("/halyde/config/shell.cfg")
import("/halyde/core/termlib.lua")
local event = import("event")
--local ocelot = component.proxy(component.list("ocelot")())
local ocelot = component.proxy(component.list("ocelot")())
local filesystem = import("filesystem")
local gpu = component.proxy(component.list("gpu")())
@@ -55,14 +55,14 @@ function _G.shell.run(command)
if not args[1] then
return
end
if filesystem.exists(args[1]) then
if filesystem.exists(args[1]) and not filesystem.isDirectory(args[1]) then
foundfile = true
local path = args[1]
table.remove(args, 1)
runAsCoroutine(path, table.unpack(args))
else
for _, item in pairs(shellcfg["path"]) do
if filesystem.exists(item..args[1]) then
if filesystem.exists(item..args[1]) and not filesystem.isDirectory(item .. args[1]) then
foundfile = true
local path = item..args[1]
table.remove(args, 1)
@@ -71,10 +71,10 @@ function _G.shell.run(command)
else -- try to look for it without the file extension
local files = filesystem.list(item)
for _, file in pairs(files) do
if args[1] == file:match("(.+)%.[^%.]+$") then
if args[1] == file:match("(.+)%.[^%.]+$") and not filesystem.isDirectory(item .. file) then
foundfile = true
table.remove(args, 1)
runAsCoroutine(item..file, table.unpack(args))
runAsCoroutine(item .. file, table.unpack(args))
break
end
end
@@ -86,14 +86,14 @@ function _G.shell.run(command)
end
end
print(shellcfg["startupMessage"])
print(shellcfg["startupMessage"]:format(shellcfg.splashMessages[math.random(1, #shellcfg.splashMessages)]))
while true do
coroutine.yield()
-- print(shell.workingDirectory .. " >")
--print(shellcfg["prompt"]:format(shell.workingDirectory),false)
-- termlib.cursorPosX = #(shell.workingDirectory .. " > ")
-- termlib.cursorPosY = termlib.cursorPosY - 1
local shellCommand = read("shell", shellcfg["prompt"]:format(shell.workingDirectory))
local shellCommand = read("shell", shellcfg.prompt:format(shell.workingDirectory))
shell.run(shellCommand)
gpu.freeAllBuffers()
end
+16 -8
View File
@@ -70,20 +70,23 @@ local function parseCodeNumbers(code)
return o
end
function _G.print(text, endNewLine, wordWrap)
function _G.print(text, endNewLine, textWrap)
-- you don't know how tiring this was just for ANSI escape code support
if endNewLine == nil then
endNewLine = true
end
if wordWrap == nil then
wordWrap = true
if textWrap == nil then
textWrap = true
end
if not text or not tostring(text) then
return
end
if text:find("\a") then
computer.beep()
end
text = "\27[0m" .. text:gsub("\t", " ")
text = tostring(text)
readBreak = 0
@@ -95,12 +98,17 @@ function _G.print(text, endNewLine, wordWrap)
if #section==0 then
return
end
gpu.set(termlib.cursorPosX,termlib.cursorPosY,section)
termlib.cursorPosX = termlib.cursorPosX+unicode.wlen(section)
if termlib.cursorPosX>width and wordWrap then
newLine()
while true do
gpu.set(termlib.cursorPosX,termlib.cursorPosY,section)
termlib.cursorPosX = termlib.cursorPosX+unicode.wlen(section)
if unicode.wlen(section) > width and textWrap then
newLine()
else
break
end
section = section:sub(width + 1)
end
section=""
section = ""
end
for i=1,#text do