git goodest
This commit is contained in:
parent
1b0a016222
commit
8355faffad
@ -51,7 +51,7 @@ local function download_file(repo_path, local_path)
|
|||||||
if not result then
|
if not result then
|
||||||
print()
|
print()
|
||||||
printError(err)
|
printError(err)
|
||||||
return
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
local f = fs.open(local_path, "w")
|
local f = fs.open(local_path, "w")
|
||||||
@ -59,6 +59,7 @@ local function download_file(repo_path, local_path)
|
|||||||
f.close()
|
f.close()
|
||||||
|
|
||||||
print("OK")
|
print("OK")
|
||||||
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
-- keep track of downloaded files
|
-- keep track of downloaded files
|
||||||
@ -80,13 +81,24 @@ end
|
|||||||
local args = {...}
|
local args = {...}
|
||||||
|
|
||||||
if #args == 0 then
|
if #args == 0 then
|
||||||
print("Syncing " .. #storage .. " files.")
|
|
||||||
|
|
||||||
for local_path, repo_path in pairs(storage) do
|
-- Lua being Lua, of course #storage won't work
|
||||||
download_file(repo_path, local_path)
|
local count = 0
|
||||||
|
for _ in pairs(storage) do
|
||||||
|
count = count + 1
|
||||||
end
|
end
|
||||||
|
|
||||||
print("Done.")
|
print("Syncing " .. count .. " files.")
|
||||||
|
|
||||||
|
local success_count = 0
|
||||||
|
for local_path, repo_path in pairs(storage) do
|
||||||
|
local success = download_file(repo_path, local_path)
|
||||||
|
if success then
|
||||||
|
success_count = success_count + 1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
print("Done. " .. success_count .. " out of " .. count .. "files synced.")
|
||||||
|
|
||||||
elseif args[1] == "sync" then
|
elseif args[1] == "sync" then
|
||||||
local usage = "gitgud sync <repo path> <local path>"
|
local usage = "gitgud sync <repo path> <local path>"
|
||||||
@ -137,4 +149,8 @@ elseif args[1] == "run" then
|
|||||||
printError(err)
|
printError(err)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
else
|
||||||
|
print("Unknown command " .. args[1])
|
||||||
|
print("Try \"sync\", \"delete\" or \"run\"")
|
||||||
|
|
||||||
end
|
end
|
Loading…
Reference in New Issue
Block a user