refactor: simplify

This commit is contained in:
2026-09-03 20:55:37 +02:00
parent 71434f947b
commit 5eb228750d
8 changed files with 176 additions and 235 deletions
+16 -16
View File
@@ -1,21 +1,5 @@
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
local function run_task(cmd)
vim.notify("󰑮 Running: " .. cmd)
@@ -36,4 +20,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