mirror of https://github.com/folke/lazy.nvim.git
feat(pkg): utils to get rock to url mappings
This commit is contained in:
parent
25981e1f39
commit
be74a8a535
|
@ -3,10 +3,8 @@ local M = {}
|
||||||
---@type table<string, string>
|
---@type table<string, string>
|
||||||
local mapping = nil
|
local mapping = nil
|
||||||
|
|
||||||
local function _load()
|
local function load()
|
||||||
if mapping then
|
if not mapping then
|
||||||
return
|
|
||||||
end
|
|
||||||
mapping = {}
|
mapping = {}
|
||||||
---@type {name:string, url:string, version:string}[]
|
---@type {name:string, url:string, version:string}[]
|
||||||
local gen = require("lazy.community._generated")
|
local gen = require("lazy.community._generated")
|
||||||
|
@ -14,12 +12,13 @@ local function _load()
|
||||||
mapping[rock.name] = rock.url
|
mapping[rock.name] = rock.url
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
return mapping
|
||||||
|
end
|
||||||
|
|
||||||
---@param rock string
|
---@param rock string
|
||||||
---@return string?
|
---@return string?
|
||||||
function M.get_url(rock)
|
function M.get_url(rock)
|
||||||
_load()
|
return load()[rock]
|
||||||
return mapping[rock]
|
|
||||||
end
|
end
|
||||||
|
|
||||||
return M
|
return M
|
||||||
|
|
Loading…
Reference in New Issue