moved cd() into a new library, shutil.

This commit is contained in:
Izaya 2017-08-01 15:49:39 +10:00
parent ed2503e9a2
commit ba8a800940
3 changed files with 13 additions and 3 deletions

View File

@ -9,6 +9,7 @@ modules/lib/print.lua
modules/drivers/kbd.lua
modules/drivers/net.lua
modules/lib/readline.lua
modules/lib/shutil.lua
modules/applications/luash.lua
modules/applications/genkernel.lua
modules/util/fs-automount.lua

View File

@ -1,8 +1,5 @@
function luash(si)
spawn("lua shell",function()
function cd(p)
os.setenv("PWD",fs.simplify((os.getenv("PWD") or "").."/"..p))
end
coroutine.yield()
print(_OSVERSION..", "..string.format("%4d",computer.totalMemory()/1024).."K memory, "..string.format("%4d",computer.freeMemory()/1024).."K free")
print(_VERSION)

12
modules/lib/shutil.lua Normal file
View File

@ -0,0 +1,12 @@
function cd(p)
os.setenv("PWD",fs.simplify((os.getenv("PWD") or "").."/"..p))
end
function ls(p)
for k,v in ipairs(fs.list(p)) do print(v) end
end
function rm(p)
fs.rm(p)
end
function mkdir(p)
fs.mkdir(p)
end