refactor: remove just helper
This commit is contained in:
@@ -1,39 +0,0 @@
|
||||
local M = {}
|
||||
|
||||
local function run_task(cmd)
|
||||
vim.notify(" Running: " .. cmd)
|
||||
|
||||
local buf = vim.api.nvim_create_buf(true, true)
|
||||
pcall(vim.api.nvim_buf_set_name, buf, "just://" .. cmd)
|
||||
|
||||
vim.api.nvim_buf_call(buf, function()
|
||||
vim.fn.termopen(cmd, {
|
||||
on_exit = function(_, code)
|
||||
if code == 0 then
|
||||
vim.notify(" " .. cmd .. " success")
|
||||
pcall(vim.api.nvim_buf_delete, buf, { force = true })
|
||||
else
|
||||
vim.notify(" " .. cmd .. " failed (" .. code .. ")", vim.log.levels.ERROR)
|
||||
end
|
||||
end,
|
||||
})
|
||||
end)
|
||||
end
|
||||
|
||||
-- Interactive picker for standard Justfile targets
|
||||
function M.pick_just_task()
|
||||
local obj = vim.system({ "just", "--summary" }, { text = true }):wait()
|
||||
if obj.code ~= 0 or not obj.stdout or obj.stdout == "" then
|
||||
return vim.notify("No recipes or justfile found", vim.log.levels.WARN)
|
||||
end
|
||||
|
||||
require("mini.pick").start({
|
||||
source = {
|
||||
items = vim.split(vim.trim(obj.stdout), "%s+"),
|
||||
name = " Just Tasks",
|
||||
choose = function(choice) run_task("just " .. choice) end,
|
||||
},
|
||||
})
|
||||
end
|
||||
|
||||
return M
|
||||
+1
-1
@@ -6,7 +6,7 @@ function M.open_terminal_app(cmd)
|
||||
|
||||
local lines = vim.o.lines - vim.o.cmdheight - (vim.o.laststatus > 0 and 1 or 0)
|
||||
local w = math.floor(vim.o.columns * 0.95)
|
||||
local h = math.floor(lines * 0.92)
|
||||
local h = math.floor(lines * 0.95)
|
||||
|
||||
local win = vim.api.nvim_open_win(buf, true, {
|
||||
relative = "editor",
|
||||
|
||||
Reference in New Issue
Block a user