style: reformat all lua code
This commit is contained in:
parent
4fee3543e0
commit
4b83da6d7f
8 changed files with 84 additions and 102 deletions
|
|
@ -11,8 +11,7 @@ return function(...)
|
||||||
|
|
||||||
local cmd_args = vim.list_extend({ "generate" }, args)
|
local cmd_args = vim.list_extend({ "generate" }, args)
|
||||||
|
|
||||||
Job
|
Job:new({
|
||||||
:new({
|
|
||||||
command = c.go,
|
command = c.go,
|
||||||
args = cmd_args,
|
args = cmd_args,
|
||||||
on_exit = function(_, retval)
|
on_exit = function(_, retval)
|
||||||
|
|
@ -23,6 +22,5 @@ return function(...)
|
||||||
|
|
||||||
u.notify("go generate was success runned", "info")
|
u.notify("go generate was success runned", "info")
|
||||||
end,
|
end,
|
||||||
})
|
}):start()
|
||||||
:start()
|
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -18,8 +18,7 @@ return function(...)
|
||||||
|
|
||||||
local cmd_args = vim.list_extend({ "get" }, args)
|
local cmd_args = vim.list_extend({ "get" }, args)
|
||||||
|
|
||||||
Job
|
Job:new({
|
||||||
:new({
|
|
||||||
command = c.go,
|
command = c.go,
|
||||||
args = cmd_args,
|
args = cmd_args,
|
||||||
on_exit = function(_, retval)
|
on_exit = function(_, retval)
|
||||||
|
|
@ -30,6 +29,5 @@ return function(...)
|
||||||
|
|
||||||
u.notify("go get was success runned", "info")
|
u.notify("go get was success runned", "info")
|
||||||
end,
|
end,
|
||||||
})
|
}):start()
|
||||||
:start()
|
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -12,8 +12,7 @@ return function(...)
|
||||||
|
|
||||||
local cmd_args = vim.list_extend({ "mod" }, args)
|
local cmd_args = vim.list_extend({ "mod" }, args)
|
||||||
|
|
||||||
Job
|
Job:new({
|
||||||
:new({
|
|
||||||
command = c.go,
|
command = c.go,
|
||||||
args = cmd_args,
|
args = cmd_args,
|
||||||
on_exit = function(_, retval)
|
on_exit = function(_, retval)
|
||||||
|
|
@ -24,6 +23,5 @@ return function(...)
|
||||||
|
|
||||||
u.notify("go mod was success runned", "info")
|
u.notify("go mod was success runned", "info")
|
||||||
end,
|
end,
|
||||||
})
|
}):start()
|
||||||
:start()
|
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -6,8 +6,7 @@ local M = {}
|
||||||
|
|
||||||
---@param cmd_args table
|
---@param cmd_args table
|
||||||
local function run(cmd_args)
|
local function run(cmd_args)
|
||||||
Job
|
Job:new({
|
||||||
:new({
|
|
||||||
command = c.gotests,
|
command = c.gotests,
|
||||||
args = cmd_args,
|
args = cmd_args,
|
||||||
on_exit = function(_, retval)
|
on_exit = function(_, retval)
|
||||||
|
|
@ -18,8 +17,7 @@ local function run(cmd_args)
|
||||||
|
|
||||||
u.notify("unit test(s) generated", "info")
|
u.notify("unit test(s) generated", "info")
|
||||||
end,
|
end,
|
||||||
})
|
}):start()
|
||||||
:start()
|
|
||||||
end
|
end
|
||||||
|
|
||||||
---@param args table
|
---@param args table
|
||||||
|
|
|
||||||
|
|
@ -54,8 +54,7 @@ return function(...)
|
||||||
}
|
}
|
||||||
|
|
||||||
local res_data
|
local res_data
|
||||||
Job
|
Job:new({
|
||||||
:new({
|
|
||||||
command = c.impl,
|
command = c.impl,
|
||||||
args = cmd_args,
|
args = cmd_args,
|
||||||
on_exit = function(data, retval)
|
on_exit = function(data, retval)
|
||||||
|
|
@ -66,8 +65,7 @@ return function(...)
|
||||||
|
|
||||||
res_data = data:result()
|
res_data = data:result()
|
||||||
end,
|
end,
|
||||||
})
|
}):sync()
|
||||||
:sync()
|
|
||||||
|
|
||||||
local pos = vim.fn.getcurpos()[2]
|
local pos = vim.fn.getcurpos()[2]
|
||||||
table.insert(res_data, 1, "")
|
table.insert(res_data, 1, "")
|
||||||
|
|
|
||||||
|
|
@ -10,8 +10,7 @@ local urls = {
|
||||||
local function install(pkg)
|
local function install(pkg)
|
||||||
local url = urls[pkg] .. "@latest"
|
local url = urls[pkg] .. "@latest"
|
||||||
|
|
||||||
Job
|
Job:new({
|
||||||
:new({
|
|
||||||
command = "go",
|
command = "go",
|
||||||
args = { "install", url },
|
args = { "install", url },
|
||||||
on_exit = function(_, retval)
|
on_exit = function(_, retval)
|
||||||
|
|
@ -22,8 +21,7 @@ local function install(pkg)
|
||||||
|
|
||||||
u.notify("install " .. url .. " finished", "info ")
|
u.notify("install " .. url .. " finished", "info ")
|
||||||
end,
|
end,
|
||||||
})
|
}):start()
|
||||||
:start()
|
|
||||||
end
|
end
|
||||||
|
|
||||||
---Install required go deps
|
---Install required go deps
|
||||||
|
|
|
||||||
|
|
@ -41,8 +41,7 @@ local function modify(...)
|
||||||
|
|
||||||
-- get result of "gomodifytags" works
|
-- get result of "gomodifytags" works
|
||||||
local res_data
|
local res_data
|
||||||
Job
|
Job:new({
|
||||||
:new({
|
|
||||||
command = c.gomodifytags,
|
command = c.gomodifytags,
|
||||||
args = cmd_args,
|
args = cmd_args,
|
||||||
on_exit = function(data, retval)
|
on_exit = function(data, retval)
|
||||||
|
|
@ -56,8 +55,7 @@ local function modify(...)
|
||||||
|
|
||||||
res_data = data:result()
|
res_data = data:result()
|
||||||
end,
|
end,
|
||||||
})
|
}):sync()
|
||||||
:sync()
|
|
||||||
|
|
||||||
-- decode goted value
|
-- decode goted value
|
||||||
local tagged = vim.json.decode(table.concat(res_data))
|
local tagged = vim.json.decode(table.concat(res_data))
|
||||||
|
|
|
||||||
|
|
@ -9,10 +9,8 @@ describe("gopher.struct_tags", function()
|
||||||
local add = require("gopher.struct_tags").add
|
local add = require("gopher.struct_tags").add
|
||||||
local name = vim.fn.tempname() .. ".go"
|
local name = vim.fn.tempname() .. ".go"
|
||||||
local input_file = vim.fn.readfile(cur_dir .. "/spec/fixtures/tags/add_input.go")
|
local input_file = vim.fn.readfile(cur_dir .. "/spec/fixtures/tags/add_input.go")
|
||||||
local output_file = vim.fn.join(
|
local output_file =
|
||||||
vim.fn.readfile(cur_dir .. "/spec/fixtures/tags/add_output.go"),
|
vim.fn.join(vim.fn.readfile(cur_dir .. "/spec/fixtures/tags/add_output.go"), "\n")
|
||||||
"\n"
|
|
||||||
)
|
|
||||||
|
|
||||||
vim.fn.writefile(input_file, name)
|
vim.fn.writefile(input_file, name)
|
||||||
vim.cmd("silent exe 'e " .. name .. "'")
|
vim.cmd("silent exe 'e " .. name .. "'")
|
||||||
|
|
@ -33,10 +31,8 @@ describe("gopher.struct_tags", function()
|
||||||
local remove = require("gopher.struct_tags").remove
|
local remove = require("gopher.struct_tags").remove
|
||||||
local name = vim.fn.tempname() .. ".go"
|
local name = vim.fn.tempname() .. ".go"
|
||||||
local input_file = vim.fn.readfile(cur_dir .. "/spec/fixtures/tags/remove_input.go")
|
local input_file = vim.fn.readfile(cur_dir .. "/spec/fixtures/tags/remove_input.go")
|
||||||
local output_file = vim.fn.join(
|
local output_file =
|
||||||
vim.fn.readfile(cur_dir .. "/spec/fixtures/tags/remove_output.go"),
|
vim.fn.join(vim.fn.readfile(cur_dir .. "/spec/fixtures/tags/remove_output.go"), "\n")
|
||||||
"\n"
|
|
||||||
)
|
|
||||||
|
|
||||||
vim.fn.writefile(input_file, name)
|
vim.fn.writefile(input_file, name)
|
||||||
vim.cmd("silent exe 'e " .. name .. "'")
|
vim.cmd("silent exe 'e " .. name .. "'")
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue