mirror of
https://github.com/folke/lazy.nvim.git
synced 2025-04-18 20:36:45 +00:00
refactor: moved all plugin state to Plugin._
This commit is contained in:
parent
352dbadcb6
commit
28af1e1ac3
9 changed files with 49 additions and 46 deletions
|
@ -8,7 +8,7 @@ M.log = {
|
|||
if opts.interactive ~= true or not Util.file_exists(plugin.dir .. "/.git") then
|
||||
return false
|
||||
end
|
||||
return plugin.updated == nil or plugin.updated.from ~= plugin.updated.to
|
||||
return plugin._.updated == nil or plugin._.updated.from ~= plugin._.updated.to
|
||||
end,
|
||||
run = function(self)
|
||||
local args = {
|
||||
|
@ -20,8 +20,8 @@ M.log = {
|
|||
"--color=never",
|
||||
}
|
||||
|
||||
if self.plugin.updated then
|
||||
table.insert(args, self.plugin.updated.from .. ".." .. (self.plugin.updated.to or "HEAD"))
|
||||
if self.plugin._.updated then
|
||||
table.insert(args, self.plugin._.updated.from .. ".." .. (self.plugin._.updated.to or "HEAD"))
|
||||
else
|
||||
table.insert(args, "--since=7 days ago")
|
||||
end
|
||||
|
@ -59,11 +59,11 @@ M.update = {
|
|||
on_exit = function(ok)
|
||||
if ok then
|
||||
local git_new = assert(Util.git_info(self.plugin.dir))
|
||||
self.plugin.updated = {
|
||||
self.plugin._.updated = {
|
||||
from = git.hash,
|
||||
to = git_new.hash,
|
||||
}
|
||||
self.plugin.dirty = not vim.deep_equal(git, git_new)
|
||||
self.plugin._.dirty = not vim.deep_equal(git, git_new)
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
@ -103,8 +103,8 @@ M.install = {
|
|||
args = args,
|
||||
on_exit = function(ok)
|
||||
if ok then
|
||||
self.plugin.installed = true
|
||||
self.plugin.dirty = true
|
||||
self.plugin._.installed = true
|
||||
self.plugin._.dirty = true
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
|
|
@ -39,8 +39,8 @@ function Task.new(plugin, type, task, opts)
|
|||
self.type = type
|
||||
self.output = ""
|
||||
self.status = ""
|
||||
plugin.tasks = plugin.tasks or {}
|
||||
table.insert(plugin.tasks, self)
|
||||
plugin._.tasks = plugin._.tasks or {}
|
||||
table.insert(plugin._.tasks, self)
|
||||
return self
|
||||
end
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ local M = {}
|
|||
|
||||
M.run = {
|
||||
needed = function(plugin)
|
||||
return plugin.dirty and (plugin.opt == false or plugin.run)
|
||||
return plugin._.dirty and (plugin.opt == false or plugin.run)
|
||||
end,
|
||||
run = function(self)
|
||||
Loader.load(self.plugin, { task = "run" }, { load_start = true })
|
||||
|
@ -47,13 +47,13 @@ M.clean = {
|
|||
vim.loop.fs_unlink(dir)
|
||||
end
|
||||
|
||||
self.plugin.installed = false
|
||||
self.plugin._.installed = false
|
||||
end,
|
||||
}
|
||||
|
||||
M.docs = {
|
||||
needed = function(plugin)
|
||||
return plugin.dirty
|
||||
return plugin._.dirty
|
||||
end,
|
||||
run = function(self)
|
||||
local docs = self.plugin.dir .. "/doc/"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue