2022-11-20 22:25:21 +00:00
|
|
|
---@param plugin LazyPlugin
|
|
|
|
---@param filter fun(task:LazyTask):boolean?
|
|
|
|
local function has_task(plugin, filter)
|
2022-11-28 10:19:50 +00:00
|
|
|
if plugin._.tasks then
|
|
|
|
for _, task in ipairs(plugin._.tasks) do
|
2022-11-20 22:25:21 +00:00
|
|
|
if filter(task) then
|
|
|
|
return true
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2022-11-23 15:12:02 +00:00
|
|
|
---@alias LazySection {title:string, filter:fun(plugin:LazyPlugin):boolean?}
|
|
|
|
|
|
|
|
---@type LazySection[]
|
2022-11-20 22:25:21 +00:00
|
|
|
return {
|
|
|
|
{
|
|
|
|
filter = function(plugin)
|
|
|
|
return has_task(plugin, function(task)
|
|
|
|
return task.error ~= nil
|
|
|
|
end)
|
|
|
|
end,
|
|
|
|
title = "Failed",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
filter = function(plugin)
|
|
|
|
return has_task(plugin, function(task)
|
2022-11-28 10:04:32 +00:00
|
|
|
return task:is_running()
|
2022-11-20 22:25:21 +00:00
|
|
|
end)
|
|
|
|
end,
|
2022-11-27 10:03:17 +00:00
|
|
|
title = "Working",
|
2022-11-23 15:12:02 +00:00
|
|
|
},
|
2022-11-24 21:05:38 +00:00
|
|
|
{
|
|
|
|
filter = function(plugin)
|
|
|
|
return has_task(plugin, function(task)
|
2022-11-28 21:03:44 +00:00
|
|
|
if task.name ~= "log" then
|
2022-11-24 21:05:38 +00:00
|
|
|
return
|
|
|
|
end
|
|
|
|
local lines = vim.split(task.output, "\n")
|
|
|
|
for _, line in ipairs(lines) do
|
|
|
|
if line:find("^%w+ %S+!:") then
|
|
|
|
return true
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end)
|
|
|
|
end,
|
|
|
|
title = "Breaking Changes",
|
|
|
|
},
|
2022-11-27 10:03:17 +00:00
|
|
|
{
|
|
|
|
---@param plugin LazyPlugin
|
|
|
|
filter = function(plugin)
|
2022-11-28 10:19:50 +00:00
|
|
|
return plugin._.updated and plugin._.updated.from ~= plugin._.updated.to
|
2022-11-27 10:03:17 +00:00
|
|
|
end,
|
|
|
|
title = "Updated",
|
|
|
|
},
|
2022-11-28 21:03:44 +00:00
|
|
|
{
|
|
|
|
---@param plugin LazyPlugin
|
|
|
|
filter = function(plugin)
|
|
|
|
return plugin._.cloned
|
|
|
|
end,
|
|
|
|
title = "Installed",
|
|
|
|
},
|
2022-12-27 18:35:18 +00:00
|
|
|
{
|
|
|
|
---@param plugin LazyPlugin
|
|
|
|
filter = function(plugin)
|
2022-12-31 15:01:59 +00:00
|
|
|
return plugin._.updates
|
2022-12-27 18:35:18 +00:00
|
|
|
end,
|
|
|
|
title = "Updates",
|
|
|
|
},
|
2022-11-22 20:12:50 +00:00
|
|
|
{
|
|
|
|
filter = function(plugin)
|
|
|
|
return has_task(plugin, function(task)
|
2022-11-28 21:03:44 +00:00
|
|
|
return task.name == "log" and vim.trim(task.output) ~= ""
|
2022-11-22 20:12:50 +00:00
|
|
|
end)
|
|
|
|
end,
|
|
|
|
title = "Log",
|
|
|
|
},
|
2022-11-20 22:25:21 +00:00
|
|
|
{
|
|
|
|
filter = function(plugin)
|
2022-12-30 20:23:12 +00:00
|
|
|
return plugin._.kind == "clean" and plugin._.installed
|
2022-11-20 22:25:21 +00:00
|
|
|
end,
|
|
|
|
title = "Clean",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
filter = function(plugin)
|
2023-01-03 09:43:10 +00:00
|
|
|
return not plugin._.installed and plugin._.kind ~= "disabled"
|
2022-11-20 22:25:21 +00:00
|
|
|
end,
|
2022-11-29 09:56:17 +00:00
|
|
|
title = "Not Installed",
|
2022-11-20 22:25:21 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
filter = function(plugin)
|
2022-11-28 10:19:50 +00:00
|
|
|
return plugin._.loaded
|
2022-11-20 22:25:21 +00:00
|
|
|
end,
|
|
|
|
title = "Loaded",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
filter = function(plugin)
|
2022-11-28 10:19:50 +00:00
|
|
|
return plugin._.installed
|
2022-11-20 22:25:21 +00:00
|
|
|
end,
|
2022-12-23 13:58:11 +00:00
|
|
|
title = "Not Loaded",
|
2022-11-20 22:25:21 +00:00
|
|
|
},
|
2023-01-03 09:43:10 +00:00
|
|
|
{
|
|
|
|
filter = function(plugin)
|
|
|
|
return plugin._.kind == "disabled"
|
|
|
|
end,
|
|
|
|
title = "Disabled",
|
|
|
|
},
|
2022-11-20 22:25:21 +00:00
|
|
|
}
|