feat: add GoTagClear command

This commit is contained in:
Oliver 2024-03-24 17:57:36 +08:00
parent ac27f4b679
commit f97eca8e22
3 changed files with 13 additions and 0 deletions

View file

@ -6,6 +6,7 @@ local cmd = require "gopher._utils.commands"
API.install_deps = require "gopher.installer"
API.tags_add = tags.add
API.tags_rm = tags.remove
API.tags_clear = tags.clear
API.impl = require "gopher.impl"
API.iferr = require "gopher.iferr"
API.comment = require "gopher.comment"

View file

@ -116,4 +116,15 @@ function M.remove(...)
modify(unpack(cmd_args))
end
---clear all tags to struct under cursor
function M.clear()
if #arg == nil or arg == "" then
arg = { "json" }
end
local cmd_args = { "-clear-tags" }
modify(unpack(cmd_args))
end
return M

View file

@ -1,5 +1,6 @@
command! -nargs=* GoTagAdd :lua require"gopher.api".tags_add(<f-args>)
command! -nargs=* GoTagRm :lua require"gopher.api".tags_rm(<f-args>)
command! -nargs=0 GoTagClear :lua require"gopher.api".tags_clear()
command! -nargs=* GoTestAdd :lua require"gopher.api".test_add(<f-args>)
command! -nargs=* GoTestsAll :lua require"gopher.api".tests_all(<f-args>)
command! -nargs=* GoTestsExp :lua require"gopher.api".test_exported(<f-args>)