allow disabling modules

This commit is contained in:
2025-07-01 23:33:33 -04:00
parent e8276e3137
commit e0f39fe0db

View File

@ -5,6 +5,7 @@ local packager = require("dep.package")
---@class module
---@field name string name of the module
---@field desc string description of the module
---@field disable boolean weather to disable all the packages inside the module
---@field path string path to the module
---@field mod table the module
---@field packages package[] all packages registed from the module
@ -18,6 +19,8 @@ local module = {}
---@return module|false module false on failure to load module
---@nodiscard
function module:new(modpath, prefix, overrides)
overrides = overrides or {}
local ok, err
local o = {}
self = {}
@ -45,6 +48,11 @@ function module:new(modpath, prefix, overrides)
o.name = o.mod.name or o.name
o.desc = o.mod.desc or o.desc
-- ensure the overrides are properly set
overrides = vim.tbl_extend("force", overrides, {
disable = o.mod.disable or overrides.disable
})
-- allow a module to be a spec
if spec_man.check(o.mod, true) ~= false then
o.mod = { o.mod }