refactor: cleanup sections and fixed handlers in view

This commit is contained in:
Folke Lemaitre 2022-11-27 11:03:17 +01:00
parent 6dc45ada55
commit 08f4804916
No known key found for this signature in database
GPG Key ID: 41F8B1FBACAE2040
2 changed files with 13 additions and 37 deletions

View File

@ -1,7 +1,7 @@
local Config = require("lazy.core.config") local Config = require("lazy.core.config")
local Util = require("lazy.util") local Util = require("lazy.util")
local Sections = require("lazy.view.sections") local Sections = require("lazy.view.sections")
local Loader = require("lazy.core.loader") local Handler = require("lazy.core.handler")
local Plugin = require("lazy.core.plugin") local Plugin = require("lazy.core.plugin")
local Text = require("lazy.view.text") local Text = require("lazy.view.text")
@ -303,11 +303,11 @@ function M:details(plugin)
table.insert(props, { "readme", "README.md" }) table.insert(props, { "readme", "README.md" })
end end
for _, loader in ipairs(Loader.types) do for handler in ipairs(Handler.handlers) do
if plugin[loader] then if plugin[handler] then
table.insert(props, { table.insert(props, {
loader, handler,
type(plugin[loader]) == "string" and plugin[loader] or table.concat(plugin[loader], ", "), type(plugin[handler]) == "string" and plugin[handler] or table.concat(plugin[handler], ", "),
"@string", "@string",
}) })
end end

View File

@ -22,44 +22,13 @@ return {
end, end,
title = "Failed", title = "Failed",
}, },
{
filter = function(plugin)
return has_task(plugin, function(task)
return task.running and task.type == "install"
end)
end,
title = "Installing",
},
{
filter = function(plugin)
return has_task(plugin, function(task)
return task.running and task.type == "update"
end)
end,
title = "Updating",
},
{
filter = function(plugin)
return has_task(plugin, function(task)
return task.running and task.type == "clean"
end)
end,
title = "Cleaning",
},
{ {
filter = function(plugin) filter = function(plugin)
return has_task(plugin, function(task) return has_task(plugin, function(task)
return task.running return task.running
end) end)
end, end,
title = "Running", title = "Working",
},
{
---@param plugin LazyPlugin
filter = function(plugin)
return plugin.updated and plugin.updated.from ~= plugin.updated.to
end,
title = "Updated",
}, },
{ {
filter = function(plugin) filter = function(plugin)
@ -77,6 +46,13 @@ return {
end, end,
title = "Breaking Changes", title = "Breaking Changes",
}, },
{
---@param plugin LazyPlugin
filter = function(plugin)
return plugin.updated and plugin.updated.from ~= plugin.updated.to
end,
title = "Updated",
},
{ {
filter = function(plugin) filter = function(plugin)
return has_task(plugin, function(task) return has_task(plugin, function(task)