diff --git a/gitea.lua b/gitea.lua new file mode 100644 index 0000000..443f164 --- /dev/null +++ b/gitea.lua @@ -0,0 +1,20 @@ +-- Use (and improve) this script to download files from https://gitea.leafbla.de/dominic/turtles/ +-- +-- Usage: gitea get FILENAME DESTINATION +-- +-- FILENAME should have the format USERDIR/FILENAME +-- in order to access USERDIR/FILENAME.lua in the repository +-- +-- DESTINATION is the name under which the script will be stored in the turtle +-- + +local args = {...} +filename = args[2] +if args[1] == "get" then + url = "https://gitea.leafbla.de/dominic/turtles/raw/branch/master/"..filename..".lua" + response = http.get(url) + local handle = io.open(args[3], "w") + handle:write(response.readAll()) + handle:close() + response.close() +end