mirror of https://github.com/folke/lazy.nvim.git
refactor: moved manage functionality to its own module
This commit is contained in:
parent
42c2fb42c8
commit
6dc45ada55
|
@ -29,7 +29,7 @@ function M.setup(opts)
|
|||
for _, plugin in pairs(Config.plugins) do
|
||||
if not plugin.installed then
|
||||
vim.cmd("do User LazyInstallPre")
|
||||
require("lazy.manager").install({
|
||||
require("lazy.manage").install({
|
||||
wait = true,
|
||||
show = Config.options.interactive,
|
||||
})
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
local Config = require("lazy.core.config")
|
||||
local Task = require("lazy.task")
|
||||
local Runner = require("lazy.runner")
|
||||
local Task = require("lazy.manage.task")
|
||||
local Runner = require("lazy.manage.runner")
|
||||
local Plugin = require("lazy.core.plugin")
|
||||
|
||||
local M = {}
|
||||
|
@ -25,10 +25,6 @@ function M.run(operation, opts, filter)
|
|||
---@type Runner
|
||||
local runner = Runner.new()
|
||||
|
||||
local on_done = function()
|
||||
vim.cmd([[do User LazyRender]])
|
||||
end
|
||||
|
||||
-- install missing plugins
|
||||
for _, plugin in pairs(plugins) do
|
||||
if filter == nil or filter(plugin) then
|
||||
|
@ -36,10 +32,6 @@ function M.run(operation, opts, filter)
|
|||
end
|
||||
end
|
||||
|
||||
if runner:is_empty() then
|
||||
return on_done()
|
||||
end
|
||||
|
||||
vim.cmd([[do User LazyRender]])
|
||||
|
||||
-- wait for install to finish
|
||||
|
@ -63,7 +55,9 @@ function M.run(operation, opts, filter)
|
|||
end
|
||||
end
|
||||
-- wait for post-install to finish
|
||||
runner:wait(on_done)
|
||||
runner:wait(function()
|
||||
vim.cmd([[do User LazyRender]])
|
||||
end)
|
||||
end)
|
||||
|
||||
if opts.wait then
|
|
@ -1,4 +1,4 @@
|
|||
local Process = require("lazy.process")
|
||||
local Process = require("lazy.manage.process")
|
||||
local Loader = require("lazy.core.loader")
|
||||
local Util = require("lazy.util")
|
||||
|
||||
|
@ -80,8 +80,11 @@ function Task:install()
|
|||
local args = {
|
||||
"clone",
|
||||
self.plugin.uri,
|
||||
"--depth=1",
|
||||
-- "--depth=1",
|
||||
-- "--filter=blob:none",
|
||||
"--filter=tree:0",
|
||||
"--recurse-submodules",
|
||||
"--single-branch",
|
||||
"--shallow-submodules",
|
||||
"--progress",
|
||||
}
|
||||
|
@ -234,6 +237,7 @@ function Task:update()
|
|||
else
|
||||
local args = {
|
||||
"pull",
|
||||
"--tags",
|
||||
"--recurse-submodules",
|
||||
"--update-shallow",
|
||||
"--progress",
|
|
@ -1,5 +1,5 @@
|
|||
local View = require("lazy.view")
|
||||
local Manager = require("lazy.manager")
|
||||
local Manage = require("lazy.manage")
|
||||
local Util = require("lazy.util")
|
||||
|
||||
local M = {}
|
||||
|
@ -17,31 +17,31 @@ end
|
|||
|
||||
M.commands = {
|
||||
clean = function()
|
||||
Manager.clean({ clear = true, show = true })
|
||||
Manage.clean({ clear = true, show = true })
|
||||
end,
|
||||
clear = function()
|
||||
Manager.clear()
|
||||
Manage.clear()
|
||||
View.show()
|
||||
end,
|
||||
install = function()
|
||||
Manager.install({ clear = true, show = true })
|
||||
Manage.install({ clear = true, show = true })
|
||||
end,
|
||||
log = function()
|
||||
Manager.log({ clear = true, show = true })
|
||||
Manage.log({ clear = true, show = true })
|
||||
end,
|
||||
show = function()
|
||||
View.show()
|
||||
end,
|
||||
docs = function()
|
||||
Manager.docs({ clear = true, show = true })
|
||||
Manage.docs({ clear = true, show = true })
|
||||
end,
|
||||
sync = function()
|
||||
Manager.update({ clear = true, show = true })
|
||||
Manager.install({ show = true })
|
||||
Manager.clean({ show = true })
|
||||
Manage.update({ clear = true, show = true })
|
||||
Manage.install({ show = true })
|
||||
Manage.clean({ show = true })
|
||||
end,
|
||||
update = function()
|
||||
Manager.update({ clear = true, show = true })
|
||||
Manage.update({ clear = true, show = true })
|
||||
end,
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue