allow disabling modules
This commit is contained in:
@ -5,6 +5,7 @@ local packager = require("dep.package")
|
|||||||
---@class module
|
---@class module
|
||||||
---@field name string name of the module
|
---@field name string name of the module
|
||||||
---@field desc string description 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 path string path to the module
|
||||||
---@field mod table the module
|
---@field mod table the module
|
||||||
---@field packages package[] all packages registed from 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
|
---@return module|false module false on failure to load module
|
||||||
---@nodiscard
|
---@nodiscard
|
||||||
function module:new(modpath, prefix, overrides)
|
function module:new(modpath, prefix, overrides)
|
||||||
|
overrides = overrides or {}
|
||||||
|
|
||||||
local ok, err
|
local ok, err
|
||||||
local o = {}
|
local o = {}
|
||||||
self = {}
|
self = {}
|
||||||
@ -45,6 +48,11 @@ function module:new(modpath, prefix, overrides)
|
|||||||
o.name = o.mod.name or o.name
|
o.name = o.mod.name or o.name
|
||||||
o.desc = o.mod.desc or o.desc
|
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
|
-- allow a module to be a spec
|
||||||
if spec_man.check(o.mod, true) ~= false then
|
if spec_man.check(o.mod, true) ~= false then
|
||||||
o.mod = { o.mod }
|
o.mod = { o.mod }
|
||||||
|
Reference in New Issue
Block a user