add TSamFile and TSamAll command with default keymaps
This commit is contained in:
@@ -172,4 +172,38 @@ function runner.build_command(spec)
|
||||
}
|
||||
end
|
||||
|
||||
function runner.build_file_command(bufnr)
|
||||
local path = util.get_buf_path(bufnr)
|
||||
if not path or path == "" then
|
||||
return nil
|
||||
end
|
||||
local root = util.find_root(path, { "go.mod", ".git" })
|
||||
if not root or root == "" then
|
||||
root = vim.loop.cwd()
|
||||
end
|
||||
local spec = { file = path, cwd = root }
|
||||
local pkg = build_pkg_arg(spec)
|
||||
local cmd = { "go", "test", "-v", pkg }
|
||||
return {
|
||||
cmd = cmd,
|
||||
cwd = root,
|
||||
}
|
||||
end
|
||||
|
||||
function runner.build_all_command(bufnr)
|
||||
local path = util.get_buf_path(bufnr)
|
||||
local root
|
||||
if path and path ~= "" then
|
||||
root = util.find_root(path, { "go.mod", ".git" })
|
||||
end
|
||||
if not root or root == "" then
|
||||
root = vim.loop.cwd()
|
||||
end
|
||||
local cmd = { "go", "test", "-v", "./..." }
|
||||
return {
|
||||
cmd = cmd,
|
||||
cwd = root,
|
||||
}
|
||||
end
|
||||
|
||||
return runner
|
||||
|
||||
Reference in New Issue
Block a user