improve log viewer

This commit is contained in:
2020-08-24 14:17:58 +01:00
parent 3a4cb56914
commit 1e2ed259fc
2 changed files with 12 additions and 4 deletions

View File

@@ -1245,13 +1245,21 @@ end
)
]],
["/rom/programs/log.lua"] = [[
local old_mode = ... == "old"
local args = table.concat({...}, " ")
local logtext
if old_mode then
if args:match "old" then
logtext = potatOS.read "old.log"
else
logtext = potatOS.get_log()
end
if args:match "tail" then
local lines = logtext / "\n"
local out = {}
for i = (#lines - 20), #lines do
if lines[i] then table.insert(out, lines[i]) end
end
logtext = table.concat(out, "\n")
end
textutils.pagedPrint(logtext)
]],
["/rom/programs/init-screens.lua"] = [[potatOS.init_screens(); print "Done!"]],