aboutsummaryrefslogtreecommitdiffstats
path: root/lua/dep.lua
diff options
context:
space:
mode:
authorSquibid <me@zacharyscheiman.com>2023-04-29 11:02:06 -0400
committerSquibid <me@zacharyscheiman.com>2023-04-29 11:02:06 -0400
commit2705f55b2580f902c7e4bb2a4c3f96d27d4a747b (patch)
treedc434daf0fadcac9731c8cd4453c92a0343057b2 /lua/dep.lua
parentb77963d2410d4dc65a1687c04103a8be58866ac6 (diff)
downloaddep-2705f55b2580f902c7e4bb2a4c3f96d27d4a747b.tar.gz
dep-2705f55b2580f902c7e4bb2a4c3f96d27d4a747b.tar.bz2
dep-2705f55b2580f902c7e4bb2a4c3f96d27d4a747b.zip
sync: add on_complete callback -- taken from trsdln on github
Diffstat (limited to '')
-rw-r--r--lua/dep.lua10
1 files changed, 7 insertions, 3 deletions
diff --git a/lua/dep.lua b/lua/dep.lua
index f0e2f7b..4cf2ddd 100644
--- a/lua/dep.lua
+++ b/lua/dep.lua
@@ -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),