refactor: simplify

This commit is contained in:
2026-09-03 20:27:45 +02:00
parent 71434f947b
commit ddd0c73341
8 changed files with 147 additions and 204 deletions
+17 -16
View File
@@ -1,21 +1,6 @@
local M = {}
--- Interactive picker for selecting and running tasks defined in a Justfile.
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
--- Runs a command in an ephemeral scratch buffer.
local function run_task(cmd)
vim.notify("󰑮 Running: " .. cmd)
@@ -36,4 +21,20 @@ local function run_task(cmd)
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