Advertisement
Le_JuiceBOX

[App] gitget.lua

Feb 15th, 2025 (edited)
281
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.13 KB | None | 0 0
  1. --==================================================================================================================================
  2. --// Name: GitGet
  3. --// Desc: Works like the pastebin command but for github raw.
  4. --// Date: 2/15/25
  5. --==================================================================================================================================
  6. --paste: TFwdaR7G
  7.  
  8. local GUC = "https://raw.githubusercontent.com/"
  9.  
  10. local args = {...}
  11.  
  12. if #args < 2 then    
  13.     print("gitget <file> <link>")
  14.     print("\n<file>\nType: string\nDesc: File location.")
  15.     print("\n<link>\nType: string\nDesc: Everything after 'https://raw.githubusercontent.com/'")
  16.     return
  17. end
  18.  
  19. local fileName = args[1]
  20. local gitLink = args[2]
  21.  
  22. local gitHttp = http.get(GUC..gitLink)
  23. local code = ""
  24.  
  25. print("\nDownloading code from github...")
  26. print("File Name: "..fileName)
  27. print()
  28.  
  29. if gitHttp then
  30.     print("Success!\n")
  31.     code = gitHttp.readAll()
  32. else
  33.     print("Download failed.")
  34.     return
  35. end
  36.    
  37. print("Writing to file...")
  38. local file = fs.open(fileName,"w")
  39. file.write(code)
  40. file.close()
  41. print("Complete.")
  42.  
  43.  
  44.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement