Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local args = {
- ...
- }
- if #args == 0 then
- print("Usage: " .. tostring(shell.getRunningProgram()) .. " <get|run> <remote_path> [local_path]")
- return
- end
- local root = args[3] or args[2] or ""
- local handle = http.get("http://173.79.117.181/" .. args[2])
- if handle then
- local data = textutils.unserialize(handle.readAll())
- for name, contents in pairs(data) do
- local path = shell.resolve(root .. "/" .. name)
- do
- local newpath = path:match("^(.-)%.lua$")
- if newpath then
- path = newpath
- end
- end
- local file = io.open(path, "w")
- file:write(contents)
- file:close()
- end
- if args[1] == "run" and data[""] then
- return shell.run(root)
- end
- else
- return print("Connection Error")
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement