mirror of https://github.com/folke/lazy.nvim.git
feat: show rockspec deps in plugin details
This commit is contained in:
parent
0f45c0d062
commit
656d3d1f5b
|
@ -1,12 +1,27 @@
|
|||
--# selene:allow(incorrect_standard_library_use)
|
||||
|
||||
local Util = require("lazy.core.util")
|
||||
local Config = require("lazy.core.config")
|
||||
local Util = require("lazy.util")
|
||||
|
||||
local M = {}
|
||||
|
||||
M.dev_suffix = "-1.rockspec"
|
||||
M.skip = { "lua" }
|
||||
|
||||
---@param plugin LazyPlugin
|
||||
function M.deps(plugin)
|
||||
local root = Config.options.rocks.root .. "/" .. plugin.name
|
||||
local manifest_file = root .. "/lib/luarocks/rocks-5.1/manifest"
|
||||
local manifest = {}
|
||||
local ok = pcall(function()
|
||||
local load, err = loadfile(manifest_file, "t", manifest)
|
||||
if not load then
|
||||
error(err)
|
||||
end
|
||||
load()
|
||||
end)
|
||||
return manifest and vim.tbl_keys(manifest.repository or {})
|
||||
end
|
||||
|
||||
---@class RockSpec
|
||||
---@field rockspec_format string
|
||||
---@field package string
|
||||
|
|
|
@ -511,6 +511,11 @@ function M:details(plugin)
|
|||
table.insert(props, { "commit", git.commit:sub(1, 7), "LazyCommit" })
|
||||
end
|
||||
end
|
||||
local rocks = require("lazy.pkg.rockspec").deps(plugin)
|
||||
if not vim.tbl_isempty(rocks) then
|
||||
table.insert(props, { "rocks", vim.inspect(rocks) })
|
||||
end
|
||||
|
||||
if Util.file_exists(plugin.dir .. "/README.md") then
|
||||
table.insert(props, { "readme", "README.md" })
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue