feat: add GoGenerate command
feat(health): add gogenerate docs(gogenerate): add doc
This commit is contained in:
parent
572c346098
commit
507ccb6347
5 changed files with 40 additions and 1 deletions
25
lua/gopher/gogenerate.lua
Normal file
25
lua/gopher/gogenerate.lua
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
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
|
||||
|
|
@ -6,7 +6,7 @@ local M = {
|
|||
{ lib = "nvim-treesitter" },
|
||||
},
|
||||
binarys = {
|
||||
{ bin = "go", help = "required for GoMod command" },
|
||||
{ bin = "go", help = "required for GoMod, GoGet, GoGenerate command" },
|
||||
{ bin = "gomodifytags", help = "required for modify struct tags" },
|
||||
{ bin = "impl", help = "required for interface implementing" },
|
||||
},
|
||||
|
|
|
|||
|
|
@ -7,5 +7,6 @@ gopher.tags_rm = tags.remove
|
|||
gopher.mod = require "gopher.gomod"
|
||||
gopher.get = require "gopher.goget"
|
||||
gopher.impl = require "gopher.impl"
|
||||
gopher.generate = require "gopher.gogenerate"
|
||||
|
||||
return gopher
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue