Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- args = {...}
- if #args < 2 then
- term.clear()
- print("Usages:")
- print("gpm [-i] [-r] <program name>")
- shell.exit()
- end
- argsHandler = {}
- argsHandler["-i"] = Install
- argsHandler["-r"] = Run
- for index,value in pairs(args) do
- if (argsHandler[value]) then
- argsHandler[value](args[#args])
- end
- end
- function Install(programName)
- shell.run("rm "..programName)
- site = http.get("https://raw.githubusercontent.com/vanhouc/computer-craft/master/" .. programName .. ".lua")
- if (site) then
- file = fs.open(programName, "w")
- if (file) then
- file.write(site.readAll())
- file.close()
- print("Successfully updated " .. programName)
- end
- else
- print("failed to load site")
- end
- end
- function Run(programName)
- shell.run(programName)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement