gopher.nvim/lua/gopher/gogenerate.lua
Smirnov Olexander 507ccb6347 feat: add GoGenerate command
feat(health): add gogenerate

docs(gogenerate): add doc
2022-06-21 14:31:37 +03:00

25 lines
565 B
Lua

local Job = require "plenary.job"
return function(...)
local args = { ... }
if #args == 1 and args[1] == "%" then
args[1] = vim.fn.expand "%" ---@diagnostic disable-line: missing-parameter
end
local cmd_args = vim.list_extend({ "generate" }, args)
Job
:new({
command = "go",
args = cmd_args,
on_exit = function(_, retval)
if retval ~= 0 then
print("command exited with code " .. retval)
return
else
print "command runs successfully"
end
end,
})
:start()
end