add a description field to modules

This commit is contained in:
2025-06-24 17:19:42 -04:00
parent fd1c5d6e79
commit 561f1d8f8b

View File

@ -3,6 +3,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 path string path to the module ---@field path string path to the module
---@field mod table the module ---@field mod table the module
local module = {} local module = {}
@ -22,6 +23,7 @@ function module:new(modpath, prefix, overrides)
setmetatable(o, self) setmetatable(o, self)
o.name = "<unnamed module>" o.name = "<unnamed module>"
o.desc = "<undescribed module>"
if type(modpath) == "string" then if type(modpath) == "string" then
if prefix ~= nil then if prefix ~= nil then
if prefix:sub(#prefix) ~= "." and modpath:sub(1, 2) ~= "." then if prefix:sub(#prefix) ~= "." and modpath:sub(1, 2) ~= "." then
@ -38,6 +40,7 @@ function module:new(modpath, prefix, overrides)
end end
end end
o.name = o.mod.name or o.name o.name = o.mod.name or o.name
o.desc = o.mod.desc or o.desc
-- 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