27 lines
596 B
Lua
27 lines
596 B
Lua
local M = {}
|
|
|
|
local function to_src(value)
|
|
if value:match("^[%w+.-]+://") or value:match("^git@") then
|
|
return value
|
|
end
|
|
|
|
return "https://github.com/" .. value
|
|
end
|
|
|
|
function M.add(specs)
|
|
local resolved = {}
|
|
|
|
for _, spec in ipairs(specs) do
|
|
if type(spec) == "string" then
|
|
table.insert(resolved, to_src(spec))
|
|
else
|
|
local plugin = vim.deepcopy(spec)
|
|
plugin.src = to_src(plugin.src)
|
|
table.insert(resolved, plugin)
|
|
end
|
|
end
|
|
|
|
vim.pack.add(resolved, { confirm = false, load = true })
|
|
end
|
|
|
|
return M |