Compare commits

..

2 Commits

Author SHA1 Message Date
0712210768 better shell printing support 2020-03-18 14:03:23 +11:00
36b1b4dfe0 made build.sh clean up after itself better 2020-03-18 14:02:58 +11:00
2 changed files with 10 additions and 10 deletions

View File

@ -9,3 +9,4 @@ mv target/tinit.lua target/init.lua
cp -r exec/ service/ lib/ target/
cp default-init.txt target/cfg/init.txt
lua finddesc.lua $(find module/ -type f) $(find lib/ -type f) > apidoc.md
rm target/version.lua

View File

@ -10,6 +10,14 @@ local function shindex(self,k)
return _G[k]
end
local function formatValue(v)
if type(v) == "table" then
local w, rs = pcall(serial.serialize,v)
if w then return rs end
end
return tostring(v)
end
function shell.interactive()
local shenv = setmetatable({}, {__index=shindex})
local run = true
@ -26,16 +34,7 @@ function shell.interactive()
local rt = {pcall(f)}
local rs = table.remove(rt,1)
for k,v in pairs(rt) do
if type(v) == "table" then
local w, s = pcall(serial.serialize,v)
if w then
print(s)
else
print(tostring(v))
end
else
print(tostring(v))
end
print(formatValue(v))
end
end
end