From: Olav Bakke Svendsen Date: Tue, 10 Oct 2023 10:22:17 +0000 (+0200) Subject: Added download utility X-Git-Tag: stable-steam~47 X-Git-Url: http://git.olavbs.no/?a=commitdiff_plain;h=514cb5b6f33d0a767ebf90bfb707932e75fcee39;p=cc.git Added download utility --- 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