mirror of
https://github.com/halfdan/dotfiles.git
synced 2025-09-10 19:56:24 +00:00
Many changes
This commit is contained in:
@@ -1,19 +1,40 @@
|
||||
local Worktree = require("git-worktree")
|
||||
local Job = require("plenary.job")
|
||||
|
||||
local function schedule_notify(message)
|
||||
vim.schedule(function()
|
||||
vim.notify.notify(message)
|
||||
end)
|
||||
end
|
||||
|
||||
local function is_massdriver()
|
||||
return not not (string.find(vim.loop.cwd(), "massdriver.git", 1, true))
|
||||
end
|
||||
|
||||
Worktree.on_tree_change(function (op, metadata)
|
||||
Worktree.on_tree_change(function(op, metadata)
|
||||
local compile_job = Job:new({
|
||||
"mix", "compile"
|
||||
command = "mix",
|
||||
args = { "compile" },
|
||||
on_start = function()
|
||||
schedule_notify("Compiling...")
|
||||
end,
|
||||
on_exit = function(_j, _return_val)
|
||||
schedule_notify("Compiling done")
|
||||
end
|
||||
})
|
||||
|
||||
local deps_job = Job:new({
|
||||
command = "mix",
|
||||
args = { "deps.get" },
|
||||
on_start = function()
|
||||
schedule_notify("Fetching dependencies...")
|
||||
end,
|
||||
on_exit = function(_j, _return_val)
|
||||
schedule_notify("Fetched dependencies")
|
||||
end
|
||||
})
|
||||
|
||||
if op == Worktree.Operations.Create and is_massdriver() then
|
||||
local deps_job = Job:new({
|
||||
"mix", "deps.get"
|
||||
})
|
||||
deps_job:and_then(compile_job)
|
||||
deps_job:sync()
|
||||
compile_job:wait()
|
||||
|
Reference in New Issue
Block a user