refactor of public plugin's api (#37)

* refactor: move all plugin functionality to init.lua

* fix(commands): now it uses correct module paths

* refactor(config): change way how it handles options

* refactor(gotests): use correct config, change way how deps required, fix some typos

* fix(healthchecker): use correct config

* refactor(iferr): change api

* refactor(impl): change api

* refactor(installer): change api

* refactor(struct_tags): change way of importting deps

* refactor(struct_tags): rename M to struct_tags

* run stylua

* refactor(dap): make it all in one file, and make some refactoring

* refactor(_utils): change way how it organizes

* fix: use new _utils api

* refactor(_utils.health): reorganize module

* refactor(_utils.ts): some renameing, moving requires lines

* run stylua
This commit is contained in:
Smirnov Oleksandr 2023-07-19 23:38:23 +03:00 committed by GitHub
parent 94250bb08a
commit 26b41bf68c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
18 changed files with 359 additions and 341 deletions

View file

@ -1,3 +1,8 @@
local Job = require "plenary.job"
local c = require("gopher.config").commands
local u = require "gopher._utils"
local installer = {}
local urls = {
gomodifytags = "github.com/fatih/gomodifytags",
impl = "github.com/josharian/impl",
@ -8,28 +13,30 @@ local urls = {
---@param pkg string
local function install(pkg)
local Job = require "plenary.job"
local u = require "gopher._utils"
local url = urls[pkg] .. "@latest"
Job:new({
command = "go",
command = c.go,
args = { "install", url },
on_exit = function(_, retval)
if retval ~= 0 then
u.notify("command 'go install " .. url .. "' exited with code " .. retval, "error")
u.deferred_notify(
"command 'go install " .. url .. "' exited with code " .. retval,
vim.log.levels.ERROR
)
return
end
u.notify("install " .. url .. " finished", "info ")
u.deferred_notify("install " .. url .. " finished", vim.log.levels.INFO)
end,
}):start()
end
---Install required go deps
return function()
function installer.install_deps()
for pkg, _ in pairs(urls) do
install(pkg)
end
end
return installer