Auto commit lazy lock changes
This commit is contained in:
parent
f83969af93
commit
a2c284693a
32
.config/nvim/lua/plugins/lazy.lua
Normal file
32
.config/nvim/lua/plugins/lazy.lua
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
vim.api.nvim_create_autocmd("User", {
|
||||||
|
pattern = "LazyUpdate",
|
||||||
|
callback = function()
|
||||||
|
local home = os.getenv("HOME") or "~/"
|
||||||
|
|
||||||
|
local cmd = {
|
||||||
|
"yadm",
|
||||||
|
"-C",
|
||||||
|
string.format("%s", home),
|
||||||
|
"commit",
|
||||||
|
".config/nvim/lazy-lock.json",
|
||||||
|
"-m",
|
||||||
|
"Update lazy-lock.json"
|
||||||
|
}
|
||||||
|
|
||||||
|
local success, process = pcall(function()
|
||||||
|
return vim.system(cmd):wait()
|
||||||
|
end)
|
||||||
|
|
||||||
|
if process and process.code == 0 then
|
||||||
|
vim.notify("Committed lazy-lock")
|
||||||
|
else
|
||||||
|
if not success then
|
||||||
|
vim.notify("Failed to run command")
|
||||||
|
else
|
||||||
|
vim.notify("Git ran, but nothing committed")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
})
|
||||||
|
|
||||||
|
return {}
|
Loading…
Reference in New Issue
Block a user