refactor(installer): use new runner
This commit is contained in:
parent
9af6797ffc
commit
18866eb6ab
1 changed files with 7 additions and 14 deletions
|
|
@ -1,6 +1,5 @@
|
||||||
local Job = require "plenary.job"
|
|
||||||
local c = require("gopher.config").commands
|
local c = require("gopher.config").commands
|
||||||
local u = require "gopher._utils"
|
local r = require "gopher._utils.runner"
|
||||||
local installer = {}
|
local installer = {}
|
||||||
|
|
||||||
local urls = {
|
local urls = {
|
||||||
|
|
@ -14,22 +13,16 @@ local urls = {
|
||||||
---@param pkg string
|
---@param pkg string
|
||||||
local function install(pkg)
|
local function install(pkg)
|
||||||
local url = urls[pkg] .. "@latest"
|
local url = urls[pkg] .. "@latest"
|
||||||
|
r.sync(c.go, {
|
||||||
Job:new({
|
|
||||||
command = c.go,
|
|
||||||
args = { "install", url },
|
args = { "install", url },
|
||||||
on_exit = function(_, retval)
|
on_exit = function(data, status)
|
||||||
if retval ~= 0 then
|
if not status == 0 then
|
||||||
u.deferred_notify(
|
error("go install failed: " .. data, vim.log.levels.ERROR)
|
||||||
"command 'go install " .. url .. "' exited with code " .. retval,
|
|
||||||
vim.log.levels.ERROR
|
|
||||||
)
|
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
vim.notify("installed: " .. url, vim.log.levels.INFO)
|
||||||
u.deferred_notify("install " .. url .. " finished", vim.log.levels.INFO)
|
|
||||||
end,
|
end,
|
||||||
}):start()
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
---Install required go deps
|
---Install required go deps
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue