refactor: minimize amount of vimscript (#96)
* refactor: remove autoload * since nvim 0.9 health.lua files are threaded as checkhealth provider * prof of concept * fix(runner.gocmd)!: i forgot to update it when i was working on #85 * fix(plugin): now commands register properly * fix(plugin): fix command name for :GoIfErr * fix(plugin): respect `setup_commands` option * docs: update * refactor(plugin): use vim.schedule * docs: update CONTRIBUTING
This commit is contained in:
parent
c5cc5080fa
commit
9aa0038125
9 changed files with 108 additions and 50 deletions
|
|
@ -25,9 +25,9 @@ end
|
|||
|
||||
---@param subcmd string
|
||||
---@param args string[]
|
||||
---@return string[]|nil
|
||||
---@return string
|
||||
function gocmd.run(subcmd, args)
|
||||
if #args == 0 then
|
||||
if #args == 0 and subcmd ~= "generate" then
|
||||
error "please provide any arguments"
|
||||
end
|
||||
|
||||
|
|
@ -39,15 +39,13 @@ function gocmd.run(subcmd, args)
|
|||
args = if_generate(args)
|
||||
end
|
||||
|
||||
return r.sync(c.go, {
|
||||
args = { subcmd, unpack(args) },
|
||||
on_exit = function(data, status)
|
||||
if status ~= 0 then
|
||||
error("gocmd failed: " .. data)
|
||||
end
|
||||
u.notify(c.go .. " " .. subcmd .. " ran successful")
|
||||
end,
|
||||
})
|
||||
local rs = r.sync { c.go, subcmd, unpack(args) }
|
||||
if rs.code ~= 0 then
|
||||
error("go " .. subcmd .. " failed: " .. rs.stderr)
|
||||
end
|
||||
|
||||
u.notify(c.go .. " " .. subcmd .. " ran successful")
|
||||
return rs.stdout
|
||||
end
|
||||
|
||||
return gocmd
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue