This repository has been archived on 2024-04-19. You can view files and clone it, but cannot push or open issues or pull requests.
FREAX/sbin/dmesg

36 lines
647 B
Text
Raw Normal View History

2022-07-18 19:33:40 +02:00
local tArgs = {...}
local logs = {}
local err = true
local function findArg(arg)
for _,v in ipairs(tArgs) do
if v == arg then
return true
end
end
return false
end
if fs.isDir("/var/log") then
logs = fs.list("/var/log")
else
kerneldraw.printAppWarning("log", "Log files non-existent")
return
end
if findArg("-l") or findArg("--list") then
shell.run("/bin/ls /var/log")
err = false
end
for _,v in ipairs(logs) do
if findArg(v) then
local logfile = kernel.printFile("/var/log/"..v)
textutils.pagedPrint(logfile)
err = false
end
end
if #tArgs < 1 or err then
kerneldraw.printAppInfo("dmesg", "Arguments not specified")
end