From 514cb5b6f33d0a767ebf90bfb707932e75fcee39 Mon Sep 17 00:00:00 2001 From: Olav Bakke Svendsen Date: Tue, 10 Oct 2023 12:22:17 +0200 Subject: [PATCH] Added download utility --- common/dl.lua | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 common/dl.lua diff --git a/common/dl.lua b/common/dl.lua new file mode 100644 index 0000000..718fdb0 --- /dev/null +++ b/common/dl.lua @@ -0,0 +1,15 @@ +-- dl.lua +-- download from git repo +-- usage: +-- dl path/to/file.lua - saves to file.lua + +local from = {...} +if from[1] then + local url = "https://git.olavbs.no/?p=cc.git;a=blob_plain;f="..from[1]..";hb=HEAD" + local to = string.match(from[1], "([^/]-)$") + if not shell.run("wget "..url.." "..to) then + print("Couldn't download "..from[1]) + end +else + print("Nothing to download") +end -- 2.30.2