v2.8.1 - Fixed some bugs with using lsdrv/lsblk.

Fixed some problems with invalid argument syntax, and components that don't support labelling.
This commit is contained in:
Ponali
2025-07-25 09:13:36 +02:00
parent 3e3d91af70
commit 89ed16eba8
3 changed files with 16 additions and 4 deletions
+14 -2
View File
@@ -1,3 +1,4 @@
local serialize = import("serialize")
local component = import("component")
local computer = import("computer")
local unicode = import("unicode")
@@ -54,6 +55,11 @@ local function defaultHeaders()
addHeader("label")
end
local function invalidArgSyntax(err)
print(err)
return shell.run("help lsdrv")
end
local outArgIdx = table.find(args,"-o") or table.find(args,"--output")
if showAll then
everyHeader()
@@ -169,8 +175,12 @@ local function handleComponent(id,type)
bootable = formatBoolean(isBootable(proxy,type))
end
local clabel = proxy.getLabel()
label=clabel and "\""..clabel.."\"" or "None"
if proxy.getLabel then
local clabel = proxy.getLabel()
label=clabel and serialize.string(clabel) or "None"
else
label="Unsupported"
end
local function insertElement(i,v)
if not tablePos[i] then return end
@@ -238,6 +248,7 @@ if not showAll then
if showArgIdx then
table.remove(args,showArgIdx)
local arg = table.remove(args,showArgIdx)
if not arg then return invalidArgSyntax("Argument -s must have a value") end
local func,err = luaExpr(arg)
if func then
filter(comps,func)
@@ -255,6 +266,7 @@ local sortArgIdx = table.find(args,"-S") or table.find(args,"--sort")
if sortArgIdx then
table.remove(args,sortArgIdx)
local arg = table.remove(args,sortArgIdx)
if not arg then return invalidArgSyntax("Argument -S must have a value") end
local func,err = luaExpr(arg)
if func then
table.sort(comps,function(a,b)
+1 -1
View File
@@ -1,7 +1,7 @@
local loadfile = ...
local filesystem = loadfile("/halyde/lib/filesystem.lua")(loadfile)
_G._OSVERSION = "Halyde 2.8.0"
_G._OSVERSION = "Halyde 2.8.1"
_G._OSLOGO = ""
local handle, tmpdata = filesystem.open("/halyde/config/oslogo.ans", "r"), nil
repeat