working commands again, terminal fixes

This commit is contained in:
Er2 2022-02-22 21:53:03 +03:00
parent b080d64053
commit d917aad352
3 changed files with 35 additions and 15 deletions

View file

@ -72,20 +72,37 @@ await(function()
end
con.print '\n'
elseif argv[1]:match '%u:' then
elseif argv[1]:match '^%u:$' then
cd = argv[1]
elseif argv[1]:lower() == 'type' then
con.print(fsRead(argv[2]))
con.print '\n'
else con.println(argv[1].. ': command not found')
elseif argv[1]:lower() == 'exit'
then runs = false
else
local v = (argv[1]:sub(-4) == '.lua'
and argv[1]
or argv[1]..'.lua')
local pat
if fsHas(cd..v) then pat = cd..v
elseif fsHas(v) then pat = v
end
if not pat
then con.println(argv[1].. ': command not found')
else local suc, msg
suc, msg = pcall(select(2,pcall(load, (fsRead(pat)))))
if not suc then con.println 'err'
else suc, msg = pcall(msg, argv, con)
if not suc then con.println(msg) end
end
end
end
return not runs
end)
return sh
end