We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 26a67e3 commit 5d9d354Copy full SHA for 5d9d354
lua/lazy/core/util.lua
@@ -201,6 +201,22 @@ function M.walk(path, fn)
201
end)
202
end
203
204
+---@param root string
205
+---@param fn fun(modname:string, modpath:string)
206
+---@param modname? string
207
+function M.walkmods(root, fn, modname)
208
+ modname = modname and (modname:gsub("%.$", "") .. ".") or ""
209
+ M.ls(root, function(path, name, type)
210
+ if name == "init.lua" then
211
+ fn(modname:gsub("%.$", ""), path)
212
+ elseif (type == "file" or type == "link") and name:sub(-4) == ".lua" then
213
+ fn(modname .. name:sub(1, -5), path)
214
+ elseif type == "directory" then
215
+ M.walkmods(path, fn, modname .. name .. ".")
216
+ end
217
+ end)
218
+end
219
+
220
---@param modname string
221
---@param fn fun(modname:string, modpath:string)
222
function M.lsmod(modname, fn)
0 commit comments