8 files changed,
84 insertions(+),
102 deletions(-)
Author:
Smirnov Oleksandr
ss2316544@gmail.com
Committed at:
2022-07-07 14:09:48 +0300
Parent:
4fee354
M
lua/gopher/gogenerate.lua
@@ -11,18 +11,16 @@ end
local cmd_args = vim.list_extend({ "generate" }, args) - Job - :new({ - command = c.go, - args = cmd_args, - on_exit = function(_, retval) - if retval ~= 0 then - u.notify("command 'go " .. unpack(cmd_args) .. "' exited with code " .. retval, "error") - return - end + Job:new({ + command = c.go, + args = cmd_args, + on_exit = function(_, retval) + if retval ~= 0 then + u.notify("command 'go " .. unpack(cmd_args) .. "' exited with code " .. retval, "error") + return + end - u.notify("go generate was success runned", "info") - end, - }) - :start() + u.notify("go generate was success runned", "info") + end, + }):start() end
M
lua/gopher/goget.lua
@@ -18,18 +18,16 @@ end
local cmd_args = vim.list_extend({ "get" }, args) - Job - :new({ - command = c.go, - args = cmd_args, - on_exit = function(_, retval) - if retval ~= 0 then - u.notify("command 'go " .. unpack(cmd_args) .. "' exited with code " .. retval, "error") - return - end + Job:new({ + command = c.go, + args = cmd_args, + on_exit = function(_, retval) + if retval ~= 0 then + u.notify("command 'go " .. unpack(cmd_args) .. "' exited with code " .. retval, "error") + return + end - u.notify("go get was success runned", "info") - end, - }) - :start() + u.notify("go get was success runned", "info") + end, + }):start() end
M
lua/gopher/gomod.lua
@@ -12,18 +12,16 @@ end
local cmd_args = vim.list_extend({ "mod" }, args) - Job - :new({ - command = c.go, - args = cmd_args, - on_exit = function(_, retval) - if retval ~= 0 then - u.notify("command 'go " .. unpack(cmd_args) .. "' exited with code " .. retval, "error") - return - end + Job:new({ + command = c.go, + args = cmd_args, + on_exit = function(_, retval) + if retval ~= 0 then + u.notify("command 'go " .. unpack(cmd_args) .. "' exited with code " .. retval, "error") + return + end - u.notify("go mod was success runned", "info") - end, - }) - :start() + u.notify("go mod was success runned", "info") + end, + }):start() end
M
lua/gopher/gotests.lua
@@ -6,20 +6,18 @@ local M = {}
---@param cmd_args table local function run(cmd_args) - Job - :new({ - command = c.gotests, - args = cmd_args, - on_exit = function(_, retval) - if retval ~= 0 then - u.notify("command 'go " .. unpack(cmd_args) .. "' exited with code " .. retval, "error") - return - end + Job:new({ + command = c.gotests, + args = cmd_args, + on_exit = function(_, retval) + if retval ~= 0 then + u.notify("command 'go " .. unpack(cmd_args) .. "' exited with code " .. retval, "error") + return + end - u.notify("unit test(s) generated", "info") - end, - }) - :start() + u.notify("unit test(s) generated", "info") + end, + }):start() end ---@param args table
M
lua/gopher/impl.lua
@@ -54,20 +54,18 @@ iface
} local res_data - Job - :new({ - command = c.impl, - args = cmd_args, - on_exit = function(data, retval) - if retval ~= 0 then - u.notify("command 'impl " .. unpack(cmd_args) .. "' exited with code " .. retval, "error") - return - end + Job:new({ + command = c.impl, + args = cmd_args, + on_exit = function(data, retval) + if retval ~= 0 then + u.notify("command 'impl " .. unpack(cmd_args) .. "' exited with code " .. retval, "error") + return + end - res_data = data:result() - end, - }) - :sync() + res_data = data:result() + end, + }):sync() local pos = vim.fn.getcurpos()[2] table.insert(res_data, 1, "")
M
lua/gopher/installer.lua
@@ -10,20 +10,18 @@ ---@param pkg string
local function install(pkg) local url = urls[pkg] .. "@latest" - Job - :new({ - command = "go", - args = { "install", url }, - on_exit = function(_, retval) - if retval ~= 0 then - u.notify("command 'go install " .. url .. "' exited with code " .. retval, "error") - return - end + Job:new({ + command = "go", + args = { "install", url }, + on_exit = function(_, retval) + if retval ~= 0 then + u.notify("command 'go install " .. url .. "' exited with code " .. retval, "error") + return + end - u.notify("install " .. url .. " finished", "info ") - end, - }) - :start() + u.notify("install " .. url .. " finished", "info ") + end, + }):start() end ---Install required go deps