1
0
mirror of https://github.com/kepler155c/opus synced 2025-10-21 10:47:40 +00:00

stack traces

This commit is contained in:
kepler155c@gmail.com
2019-03-07 13:14:16 -05:00
parent a4145951f7
commit 89f95ca45b
4 changed files with 16 additions and 16 deletions

View File

@@ -15,17 +15,17 @@ UI:configure('Network', ...)
local gridColumns = {
{ heading = 'Label', key = 'label' },
{ heading = 'Dist', key = 'distance' },
{ heading = 'Dist', key = 'distance', align = 'right' },
{ heading = 'Status', key = 'status' },
}
local config = Config.load('network', { })
if UI.term.width >= 30 then
table.insert(gridColumns, { heading = 'Fuel', key = 'fuel', width = 5 })
table.insert(gridColumns, { heading = 'Fuel', key = 'fuel', width = 5, align = 'right' })
end
if UI.term.width >= 40 then
table.insert(gridColumns, { heading = 'Uptime', key = 'uptime' })
table.insert(gridColumns, { heading = 'Uptime', key = 'uptime', align = 'right' })
end
local page = UI.Page {
@@ -262,8 +262,10 @@ function page.grid:getDisplayValues(row)
if row.uptime then
if row.uptime < 60 then
row.uptime = string.format("%ds", math.floor(row.uptime))
elseif row.uptime < 3600 then
row.uptime = string.format("%sm", math.floor(row.uptime / 60))
else
row.uptime = string.format("%sm", math.floor(row.uptime/6)/10)
row.uptime = string.format("%sh", math.floor(row.uptime / 3600))
end
end
if row.fuel then

View File

@@ -13,6 +13,7 @@ sandboxEnv.shell = shell
_G.requireInjector(_ENV)
local trace = require('trace')
local Util = require('util')
local DIR = (parentShell and parentShell.dir()) or ""
@@ -88,7 +89,7 @@ function shell.run(...)
local env = setmetatable(Util.shallowCopy(sandboxEnv), { __index = _G })
_G.requireInjector(env)
local r = { pcall(run, env, ...) }
local r = { trace(run, env, ...) }
if _ENV.multishell then
_ENV.multishell.setTitle(_ENV.multishell.getCurrent(), oldTitle or 'shell')