Advertisement
MatthewJ217

New Epoch installer

Nov 1st, 2024 (edited)
36
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.35 KB | None | 0 0
  1. -- WIP new installer for Epoch with dependency management and command aliasing
  2.  
  3. local programURL = "https://raw.githubusercontent.com/Haeleon/Epoch/main/programs/"
  4. local programs = {
  5.     installer={
  6.         args=nil,
  7.         libdeps=nil,
  8.     },
  9.     fast_excavate={
  10.         args={"#width", "<#length>"},
  11.         libdeps={"self"},
  12.     },
  13.     fill={
  14.         args={"#x1", "#y1", "#z1", "#x2", "#y2", "#z2", "'blockname'", "<'replace|hollow|frame|corners'>"},
  15.         libdeps=nil,
  16.     },
  17. }
  18.  
  19. local libraryURL = "https://raw.githubusercontent.com/Haeleon/Epoch/main/programs/"
  20. local libraries = {
  21.     build={
  22.         libdeps=nil,
  23.     },
  24.     self={
  25.         libdeps=nil,
  26.     }
  27. }
  28.  
  29. shell.run("cd /")
  30. shell.run("delete epoch/")
  31.  
  32. for k, v in pairs(libraries) do
  33.     shell.run("wget "..libraryURL..k..".lua epoch/"..k..".lua")
  34. end
  35.  
  36. for k, v in pairs(programs) do
  37.     shell.run("wget "..programURL..k..".lua epoch/"..k..".lua")
  38.  
  39.     shell.setAlias(k, "epoch/"..k..".lua")
  40.  
  41.     if v.args then
  42.     shell.setCompletionFunction(
  43.     "epoch/"..k..".lua",
  44.         function(_, i, c)
  45.             local n = i
  46.             if #c < 1 then
  47.                 return {
  48.                     table.concat(v.args, " ", n)
  49.                 }
  50.             end
  51.             if n < #v.args then
  52.                 return {" "}
  53.             end
  54.         end
  55.     )
  56.  
  57.     end
  58. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement