kd2bwzgen

Installer - Emac

Jul 7th, 2017
345
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.10 KB | None | 0 0
  1. local programName = "Emac Editor"
  2. local creatorName = "MineRobber"
  3. local function getFile(user,repo,branch,file,outfile)
  4. local fileg = http.get("https://raw.githubusercontent.com/"..user.."/"..repo.."/"..branch.."/"..file)
  5. --print("https://raw.githubusercontent.com/"..user.."/"..repo.."/"..branch.."/"..file)
  6. local out = fs.open(outfile,"w")
  7. out.write(fileg.readAll())
  8. out.close()
  9. fileg.close()
  10. end
  11. local function setColor(c)
  12. if term.isColor() then term.setTextColor(c) end
  13. end
  14. local function install()
  15. print("Installing...")
  16. getFile("MineRobber9000","CC-Scripts","master","emac/src/main.lua","emac.lua")
  17. sleep(1)
  18. setColor(colors.green)
  19. print("Done!")
  20. setColor(colors.white)
  21. end
  22. -- main functionality begins here
  23. term.clear()
  24. term.setCursorPos(1,1)
  25. print(programName.." by "..creatorName)
  26. write("Do you want to install?(y/N) ")
  27. local tEvent = { os.pullEvent("char") }
  28. if tEvent[2]=="y" then
  29. setColor(colors.green)
  30. print("[YES]")
  31. setColor(colors.white)
  32. install()
  33. else
  34. setColor(colors.red)
  35. print("[NO]")
  36. setColor(colors.white)
  37. print("Thank you for considering!")
  38. end
Add Comment
Please, Sign In to add comment