improve log viewer
This commit is contained in:
12
src/main.lua
12
src/main.lua
@@ -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!"]],
|
||||
|
Reference in New Issue
Block a user