v1.3.0 - Added a better logo to fetch, _OSLOGO, fixed possible ls bug.

This commit is contained in:
TheWahlolly
2025-05-21 16:31:27 +03:00
parent 97ed964d32
commit 611841e128
6 changed files with 93 additions and 75 deletions
+2 -1
View File
@@ -1,7 +1,7 @@
local agcfg = { local agcfg = {
["halyde"] = { ["halyde"] = {
["maindir"] = "", ["maindir"] = "",
["version"] = "1.2.0", ["version"] = "1.3.0",
["description"] = "A universal, customizable and feature-packed operating system for OpenComputers.", ["description"] = "A universal, customizable and feature-packed operating system for OpenComputers.",
["directories"] = { ["directories"] = {
"halyde/apps", "halyde/apps",
@@ -37,6 +37,7 @@ local agcfg = {
"halyde/apps/mkdir.lua", "halyde/apps/mkdir.lua",
"halyde/apps/mv.lua", "halyde/apps/mv.lua",
"halyde/apps/rm.lua", "halyde/apps/rm.lua",
"halyde/config/oslogo.ans",
"halyde/config/shell.cfg", "halyde/config/shell.cfg",
"halyde/config/startupapps.cfg", "halyde/config/startupapps.cfg",
"halyde/core/boot.lua", "halyde/core/boot.lua",
+2 -5
View File
@@ -23,6 +23,7 @@ Ahalyde/apps/ls.lua
Ahalyde/apps/lua.lua Ahalyde/apps/lua.lua
Ahalyde/apps/mv.lua Ahalyde/apps/mv.lua
Ahalyde/apps/rm.lua Ahalyde/apps/rm.lua
Ahalyde/config/oslogo.ans
Ahalyde/config/shell.cfg Ahalyde/config/shell.cfg
Ahalyde/config/startupapps.cfg Ahalyde/config/startupapps.cfg
Ahalyde/core/boot.lua Ahalyde/core/boot.lua
@@ -36,11 +37,7 @@ Ahalyde/lib/component.lua
Ahalyde/lib/event.lua Ahalyde/lib/event.lua
Ahalyde/lib/filesystem.lua Ahalyde/lib/filesystem.lua
Ahalyde/lib/raster.lua" Ahalyde/lib/raster.lua"
<<<<<<< HEAD V1.3.0
V1.2.0
=======
V1.1.0
>>>>>>> 9a8648835a1ec5569f7d33744d5eec1d9db9dd0b
Ahalyde/ Ahalyde/
Ahalyde/apps/ Ahalyde/apps/
Ahalyde/apps/helpdb/ Ahalyde/apps/helpdb/
+18 -23
View File
@@ -1,21 +1,19 @@
print("") local function printstat(text)
print("") termlib.cursorPosX = 35
print(" \27[93m┌┬┐ ┌┐ ┌┐ \n ││├─┤├┬┬┘├─┐\n │┐├┘││││││││\n ││││││││││┌┤\n └┴┴─┴┼┐├─┴─┘\n └─┘ ") print(text, true, false)
termlib.cursorPosX, termlib.cursorPosY = 17, termlib.cursorPosY - 8 end
print("\27[92mOS\27[0m: ".._OSVERSION)
termlib.cursorPosX = 17 print(_OSLOGO, true, false)
print("\27[92mArchitecture\27[0m: ".._VERSION) termlib.cursorPosY = termlib.cursorPosY - 18
termlib.cursorPosX = 17 printstat("\27[92mOS\27[0m: ".._OSVERSION)
printstat("\27[92mArchitecture\27[0m: ".._VERSION)
local componentCounter = 0 local componentCounter = 0
for _, _ in component.list() do for _, _ in component.list() do
componentCounter = componentCounter + 1 componentCounter = componentCounter + 1
end end
print("\27[92mComponents\27[0m: "..tostring(componentCounter)) printstat("\27[92mComponents\27[0m: "..tostring(componentCounter))
termlib.cursorPosX = 17 printstat("\27[92mCoroutines\27[0m: "..tostring(#cormgr.corList))
print("\27[92mCoroutines\27[0m: "..tostring(#cormgr.corList)) printstat("\27[92mBattery\27[0m: "..tostring(math.floor(computer.energy() / computer.maxEnergy() * 1000 + 0.5) / 10).."%")
termlib.cursorPosX = 17
print("\27[92mBattery\27[0m: "..tostring(math.floor(computer.energy() / computer.maxEnergy() * 1000 + 0.5) / 10).."%")
termlib.cursorPosX = 17
local totalMemory = computer.totalMemory() local totalMemory = computer.totalMemory()
local usedMemory = computer.totalMemory() - computer.freeMemory() local usedMemory = computer.totalMemory() - computer.freeMemory()
local totalMemoryString local totalMemoryString
@@ -38,8 +36,7 @@ elseif convert(usedMemory, "B", "KiB") >= 1 then
else else
usedMemoryString = tostring(usedMemory) .. " B" usedMemoryString = tostring(usedMemory) .. " B"
end end
print("\27[92mMemory\27[0m: "..usedMemoryString.." / "..totalMemoryString) printstat("\27[92mMemory\27[0m: "..usedMemoryString.." / "..totalMemoryString)
termlib.cursorPosX = 17
local totalDisk = component.invoke(computer.getBootAddress(), "spaceTotal") local totalDisk = component.invoke(computer.getBootAddress(), "spaceTotal")
local usedDisk = component.invoke(computer.getBootAddress(), "spaceUsed") local usedDisk = component.invoke(computer.getBootAddress(), "spaceUsed")
local totalDiskString local totalDiskString
@@ -62,11 +59,9 @@ elseif convert(usedDisk, "B", "KiB") >= 1 then
else else
usedDiskString = tostring(usedDisk) .. " B" usedDiskString = tostring(usedDisk) .. " B"
end end
print("\27[92mDisk\27[0m: "..usedDiskString.." / "..totalDiskString) printstat("\27[92mDisk\27[0m: "..usedDiskString.." / "..totalDiskString)
termlib.cursorPosX = 17
local width, height = component.invoke(component.list("gpu")(), "getResolution") local width, height = component.invoke(component.list("gpu")(), "getResolution")
print("\27[92mResolution\27[0m: "..tostring(width).."x"..tostring(height).."\n") printstat("\27[92mResolution\27[0m: "..tostring(width).."x"..tostring(height).."\n")
termlib.cursorPosX = 17 printstat("\27[40m \27[41m \27[42m \27[43m \27[44m \27[45m \27[46m \27[47m ")
print("\27[40m \27[41m \27[42m \27[43m \27[44m \27[45m \27[46m \27[47m ") printstat("\27[100m \27[101m \27[102m \27[103m \27[104m \27[105m \27[106m \27[107m ")
termlib.cursorPosX = 17 termlib.cursorPosY = termlib.cursorPosY + 5
print("\27[100m \27[101m \27[102m \27[103m \27[104m \27[105m \27[106m \27[107m ")
+46 -44
View File
@@ -20,51 +20,53 @@ end
local files = fs.list(target) local files = fs.list(target)
for _, file in pairs(files) do if files then
if file:sub(-1, -1) == "/" then for _, file in pairs(files) do
table.insert(dirTable, file) if file:sub(-1, -1) == "/" then
file = file:sub(1, -2) table.insert(dirTable, file)
else file = file:sub(1, -2)
table.insert(fileTable, file)
end
if unicode.wlen(file) > maxLength then
maxLength = unicode.wlen(file)
end
end
table.sort(dirTable)
table.sort(fileTable)
files = {}
for _, v in ipairs(dirTable) do
table.insert(files, v)
end
for _, v in ipairs(fileTable) do
table.insert(files, v)
end
dirTable, fileTable = nil, nil
for _, file in ipairs(files) do
local dir = false
local filetext
if file:sub(-1, -1) == "/" then -- i think this is a more efficient way to check if it's a directory
dir = true
filetext = "\27[93m"..file:sub(1, -2)
elseif file:find(".") and file:match("[^.]+$") == "lua" then
filetext = "\27[92m"..file
end
filetext = (filetext or file)..string.rep(" ", maxLength - unicode.wlen(file) + margin)
if dir then
print(filetext.." \27[0m[DIR]")
else
local size = fs.size(target .. file)
local sizeString
if convert(size, "B", "GiB") >= 1 then
sizeString = tostring(math.floor(convert(size, "B", "GiB") * 100 + 0.5) / 100).." GiB"
elseif convert(size, "B", "MiB") >= 1 then
sizeString = tostring(math.floor(convert(size, "B", "MiB") * 100 + 0.5) / 100).." MiB"
elseif convert(size, "B", "KiB") >= 1 then
sizeString = tostring(math.floor(convert(size, "B", "KiB") * 100 + 0.5) / 100).." KiB"
else else
sizeString = tostring(size).." B" table.insert(fileTable, file)
end
if unicode.wlen(file) > maxLength then
maxLength = unicode.wlen(file)
end
end
table.sort(dirTable)
table.sort(fileTable)
files = {}
for _, v in ipairs(dirTable) do
table.insert(files, v)
end
for _, v in ipairs(fileTable) do
table.insert(files, v)
end
dirTable, fileTable = nil, nil
for _, file in ipairs(files) do
local dir = false
local filetext
if file:sub(-1, -1) == "/" then -- i think this is a more efficient way to check if it's a directory
dir = true
filetext = "\27[93m"..file:sub(1, -2)
elseif file:find(".") and file:match("[^.]+$") == "lua" then
filetext = "\27[92m"..file
end
filetext = (filetext or file)..string.rep(" ", maxLength - unicode.wlen(file) + margin)
if dir then
print(filetext.." \27[0m[DIR]")
else
local size = fs.size(target .. file)
local sizeString
if convert(size, "B", "GiB") >= 1 then
sizeString = tostring(math.floor(convert(size, "B", "GiB") * 100 + 0.5) / 100).." GiB"
elseif convert(size, "B", "MiB") >= 1 then
sizeString = tostring(math.floor(convert(size, "B", "MiB") * 100 + 0.5) / 100).." MiB"
elseif convert(size, "B", "KiB") >= 1 then
sizeString = tostring(math.floor(convert(size, "B", "KiB") * 100 + 0.5) / 100).." KiB"
else
sizeString = tostring(size).." B"
end
print(filetext.."\27[0m"..sizeString)
end end
print(filetext.."\27[0m"..sizeString)
end end
end end
+17
View File
@@ -0,0 +1,17 @@
           @@@@@@@@@@          
      /@@@@@@@@@@@@@@@@@@/     
    @@@@@@#**********#@@@@@@   
  /@@@@%*********/(#%(**%@@@@/ 
 @@@@@***********@@@@@****@@@@@
@@@@%*#@@@@#*****#@@@@#****%@@@@
@@@@***@@@@@******@@@@@*****@@@@
@@@#***#@@@@&@@@@@@@@@@#****#@@@
@@@#****@@@@@@@@@@@@@@@@****#@@@
@@@%****#@@@@@&%#(*(@@@@%***%@@@
@@@@/****@@@@@******&@@@@/*/@@@@
@@@@@/***(@@@@%*****(@@&%//@@@@@
  @@@@#***&@@@@/*********#@@@@ 
   @@@@@%*//***********%@@@@@  
     @@@@@@@%(****(%@@@@@@@    
        @@@@@@@@@@@@@@@@       

+8 -2
View File
@@ -1,7 +1,13 @@
local loadfile = ... local loadfile = ...
local filesystem = loadfile("/halyde/lib/filesystem.lua")(loadfile) local filesystem = loadfile("/halyde/lib/filesystem.lua")(loadfile)
_G._OSVERSION = "Halyde 1.2.0" _G._OSVERSION = "Halyde 1.3.0"
_G._OSLOGO = ""
local handle, tmpdata = filesystem.open("/halyde/config/oslogo.ans", "r"), nil
repeat
tmpdata = handle:read(math.huge)
_OSLOGO = _OSLOGO .. (tmpdata or "")
until not tmpdata
local gpu = component.proxy(component.list("gpu")()) local gpu = component.proxy(component.list("gpu")())
local screenAddress = component.list("screen")() local screenAddress = component.list("screen")()
@@ -60,5 +66,5 @@ end
--local handle = assert(filesystem.open("/bazinga.txt", "w")) --local handle = assert(filesystem.open("/bazinga.txt", "w"))
--assert(handle:write("Bazinga!")) --assert(handle:write("Bazinga!"))
--handle:close() --handle:close()
import("/halyde/core/cormgr.lua") import("/halyde/core/cormgr.lua")