From 7926a88258d96642db238a1d7aa0fc1c9413b95e Mon Sep 17 00:00:00 2001 From: Dominic Zimmer Date: Sat, 4 Jul 2020 12:22:52 +0200 Subject: [PATCH] Add gitea.lua --- gitea.lua | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 gitea.lua 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