mirror of https://github.com/folke/lazy.nvim.git
feat(api): return runner from manage operations
This commit is contained in:
parent
dda5c6c0ed
commit
71e4b92fd6
|
@ -10,6 +10,7 @@ local M = {}
|
||||||
---@field show? boolean
|
---@field show? boolean
|
||||||
---@field mode? string
|
---@field mode? string
|
||||||
---@field plugins? LazyPlugin[]
|
---@field plugins? LazyPlugin[]
|
||||||
|
---@field concurrency? number
|
||||||
|
|
||||||
---@param ropts RunnerOpts
|
---@param ropts RunnerOpts
|
||||||
---@param opts? ManagerOpts
|
---@param opts? ManagerOpts
|
||||||
|
@ -20,7 +21,7 @@ function M.run(ropts, opts)
|
||||||
ropts.plugins = opts.plugins
|
ropts.plugins = opts.plugins
|
||||||
end
|
end
|
||||||
|
|
||||||
ropts.concurrency = ropts.concurrency or Config.options.concurrency
|
ropts.concurrency = ropts.concurrency or opts.concurrency or Config.options.concurrency
|
||||||
|
|
||||||
if opts.clear then
|
if opts.clear then
|
||||||
M.clear()
|
M.clear()
|
||||||
|
@ -52,7 +53,7 @@ end
|
||||||
|
|
||||||
---@param opts? ManagerOpts
|
---@param opts? ManagerOpts
|
||||||
function M.install(opts)
|
function M.install(opts)
|
||||||
M.run({
|
return M.run({
|
||||||
pipeline = {
|
pipeline = {
|
||||||
"git.clone",
|
"git.clone",
|
||||||
"git.checkout",
|
"git.checkout",
|
||||||
|
@ -69,7 +70,7 @@ end
|
||||||
---@param opts? ManagerOpts|{lockfile?:boolean}
|
---@param opts? ManagerOpts|{lockfile?:boolean}
|
||||||
function M.update(opts)
|
function M.update(opts)
|
||||||
opts = opts or {}
|
opts = opts or {}
|
||||||
M.run({
|
return M.run({
|
||||||
pipeline = {
|
pipeline = {
|
||||||
"git.branch",
|
"git.branch",
|
||||||
"git.fetch",
|
"git.fetch",
|
||||||
|
@ -87,9 +88,10 @@ function M.update(opts)
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
---@param opts? ManagerOpts
|
||||||
function M.check(opts)
|
function M.check(opts)
|
||||||
opts = opts or {}
|
opts = opts or {}
|
||||||
M.run({
|
return M.run({
|
||||||
pipeline = {
|
pipeline = {
|
||||||
"git.fetch",
|
"git.fetch",
|
||||||
"wait",
|
"wait",
|
||||||
|
@ -103,7 +105,7 @@ end
|
||||||
|
|
||||||
---@param opts? ManagerOpts
|
---@param opts? ManagerOpts
|
||||||
function M.log(opts)
|
function M.log(opts)
|
||||||
M.run({
|
return M.run({
|
||||||
pipeline = { "git.log" },
|
pipeline = { "git.log" },
|
||||||
plugins = function(plugin)
|
plugins = function(plugin)
|
||||||
return plugin.uri and plugin._.installed
|
return plugin.uri and plugin._.installed
|
||||||
|
@ -113,7 +115,7 @@ end
|
||||||
|
|
||||||
---@param opts? ManagerOpts
|
---@param opts? ManagerOpts
|
||||||
function M.clean(opts)
|
function M.clean(opts)
|
||||||
M.run({
|
return M.run({
|
||||||
pipeline = { "fs.clean" },
|
pipeline = { "fs.clean" },
|
||||||
plugins = Config.to_clean,
|
plugins = Config.to_clean,
|
||||||
}, opts)
|
}, opts)
|
||||||
|
@ -122,6 +124,7 @@ end
|
||||||
function M.clear()
|
function M.clear()
|
||||||
Plugin.load()
|
Plugin.load()
|
||||||
for _, plugin in pairs(Config.plugins) do
|
for _, plugin in pairs(Config.plugins) do
|
||||||
|
plugin._.has_updates = nil
|
||||||
plugin._.updated = nil
|
plugin._.updated = nil
|
||||||
plugin._.cloned = nil
|
plugin._.cloned = nil
|
||||||
plugin._.dirty = nil
|
plugin._.dirty = nil
|
||||||
|
|
Loading…
Reference in New Issue