Added download utility
authorOlav Bakke Svendsen <mail@olavbs.no>
Tue, 10 Oct 2023 10:22:17 +0000 (12:22 +0200)
committerOlav Bakke Svendsen <mail@olavbs.no>
Tue, 10 Oct 2023 10:22:17 +0000 (12:22 +0200)
common/dl.lua [new file with mode: 0644]

diff --git a/common/dl.lua b/common/dl.lua
new file mode 100644 (file)
index 0000000..718fdb0
--- /dev/null
@@ -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