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