sync: add on_complete callback -- taken from trsdln on github

This commit is contained in:
2023-04-29 11:02:06 -04:00
parent b77963d241
commit 2705f55b25

View File

@ -548,7 +548,7 @@ local function sync(package, cb)
end
end
local function sync_list(list)
local function sync_list(list, on_complete)
local progress = 0
local has_errors = false
@ -565,6 +565,10 @@ local function sync_list(list)
else
logger:log("update", string.format("synchronized %s %s", #list, #list == 1 and "package" or "packages"))
end
if on_complete then
on_complete()
end
end
end
@ -819,8 +823,8 @@ end
--todo: prevent multiple execution of async routines
return setmetatable({
sync = wrap_api("dep.sync", function()
sync_list(packages)
sync = wrap_api("dep.sync", function(on_complete)
sync_list(packages, on_complete)
end),
reload = wrap_api("dep.reload", reload_all),