-- usage:
-- dl repo[:tag] remote/path:local/path[:o] [remote/path:local/path[:o] ...]
-local args = table.unpack({...})
+local args = {...}
local repo = ""
local tag = ""
local files = {}
do
local repotag = table.remove(args, 1)
- repo, tag = string.match(args[1], "^([^:]+):?(.*)$")
+ repo, tag = string.match(repotag, "^([^:]+):?(.*)$")
if tag == "" then tag = "HEAD" end
for _, file in pairs(args) do
local from, rest = string.match(file, "^/?([^:%s]+):?(.*)$")
end
for _, file in pairs(files) do
- local url = "https://git.olavbs.no/?p="..repo..".git;a=blob_plain;f="..from..";hb="..tag
+ local url = "https://git.olavbs.no/?p="..repo..".git;a=blob_plain;f="..file.from..";hb="..tag
if fs.exists(file.to) and file.overwrite then
local tmp = textutils.serialize(math.random(100000,999999))
- local ok = shell.run("wget "..file.from.." "..tmp)
+ local ok = shell.run("wget "..url.." "..tmp)
if ok then
print("Overwriting "..file.to)
fs.delete(file.to)
fs.move(tmp,file.to)
end
else
- shell.run("wget "..file.from.." "..file.to)
+ shell.run("wget "..url.." "..file.to)
end
end