Skip to content

Commit

Permalink
feat(api): return runner from manage operations
Browse files Browse the repository at this point in the history
  • Loading branch information
folke committed Dec 5, 2022
1 parent dda5c6c commit 71e4b92
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions lua/lazy/manage/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ local M = {}
---@field show? boolean
---@field mode? string
---@field plugins? LazyPlugin[]
---@field concurrency? number

---@param ropts RunnerOpts
---@param opts? ManagerOpts
Expand All @@ -20,7 +21,7 @@ function M.run(ropts, opts)
ropts.plugins = opts.plugins
end

ropts.concurrency = ropts.concurrency or Config.options.concurrency
ropts.concurrency = ropts.concurrency or opts.concurrency or Config.options.concurrency

if opts.clear then
M.clear()
Expand Down Expand Up @@ -52,7 +53,7 @@ end

---@param opts? ManagerOpts
function M.install(opts)
M.run({
return M.run({
pipeline = {
"git.clone",
"git.checkout",
Expand All @@ -69,7 +70,7 @@ end
---@param opts? ManagerOpts|{lockfile?:boolean}
function M.update(opts)
opts = opts or {}
M.run({
return M.run({
pipeline = {
"git.branch",
"git.fetch",
Expand All @@ -87,9 +88,10 @@ function M.update(opts)
end)
end

---@param opts? ManagerOpts
function M.check(opts)
opts = opts or {}
M.run({
return M.run({
pipeline = {
"git.fetch",
"wait",
Expand All @@ -103,7 +105,7 @@ end

---@param opts? ManagerOpts
function M.log(opts)
M.run({
return M.run({
pipeline = { "git.log" },
plugins = function(plugin)
return plugin.uri and plugin._.installed
Expand All @@ -113,7 +115,7 @@ end

---@param opts? ManagerOpts
function M.clean(opts)
M.run({
return M.run({
pipeline = { "fs.clean" },
plugins = Config.to_clean,
}, opts)
Expand All @@ -122,6 +124,7 @@ end
function M.clear()
Plugin.load()
for _, plugin in pairs(Config.plugins) do
plugin._.has_updates = nil
plugin._.updated = nil
plugin._.cloned = nil
plugin._.dirty = nil
Expand Down

0 comments on commit 71e4b92

Please sign in to comment.