issue #273 sync install binaries

pull/274/head
ray-x 1 year ago
parent adc24af96c
commit d7865272a5

@ -48,6 +48,26 @@ local function is_installed(bin)
return false
end
local function go_install_sync(pkg)
local u = url[pkg]
if u == nil then
vim.notify(
'command ' .. pkg .. ' not supported, please update install.lua, or manually install it',
vim.lsp.log_levels.WARN
)
return
end
u = u .. '@latest'
local setup = { 'go', 'install', u }
local output = vim.fn.system(table.concat(setup, ' '))
if vim.v.shell_error ~= 0 then
vim.notify('install ' .. pkg .. ' failed: ' .. output, vim.lsp.log_levels.ERROR)
else
vim.notify('install ' .. pkg .. ' success', vim.lsp.log_levels.INFO)
end
end
local function go_install(pkg)
local u = url[pkg]
if u == nil then
@ -102,6 +122,15 @@ local function install_all()
end
end
local function install_all_sync()
for key, _ in pairs(url) do
if not is_installed(key) then
vim.notify('installing ' .. key, vim.lsp.log_levels.INFO)
go_install_sync(key)
end
end
end
local function update_all()
for key, _ in pairs(url) do
update(key)

Loading…
Cancel
Save