Start playing around with lua for sync script
Lua coroutines look interesting for making it asynchronous, need to investigate further.
This commit is contained in:
parent
b17ad1be44
commit
f6c700bf65
38
home/scripts/sync-all.lua
Executable file
38
home/scripts/sync-all.lua
Executable file
|
@ -0,0 +1,38 @@
|
||||||
|
#!/usr/bin/env nix-shell
|
||||||
|
--[[
|
||||||
|
#!nix-shell -i lua -p git git-sync
|
||||||
|
]]
|
||||||
|
local config_home
|
||||||
|
if os.getenv("XDG_CONFIG_HOME") then
|
||||||
|
config_home = os.getenv("XDG_CONFIG_HOME")
|
||||||
|
else
|
||||||
|
config_home = "~/.config/"
|
||||||
|
end
|
||||||
|
|
||||||
|
local sync_mapping = {
|
||||||
|
["~/.password-store"] = "https://git.xenia.me.uk/pixelifytica/pass.git",
|
||||||
|
["~/.elfeed"] = "https://git.xenia.me.uk/pixelifytica/elfeed.git",
|
||||||
|
["~/Documents/Org"] = "https://git.xenia.me.uk/pixelifytica/org.git",
|
||||||
|
["~/Documents/References"] = "https://git.xenia.me.uk/pixelifytica/references.git",
|
||||||
|
}
|
||||||
|
|
||||||
|
local pull_mapping = {
|
||||||
|
["/etc/nixos"] = "https://git.xenia.me.uk/pixelifytica/nixos.git",
|
||||||
|
[config_home .. "/emacs"] = "https://git.xenia.me.uk/pixelifytica/emacs.git",
|
||||||
|
}
|
||||||
|
|
||||||
|
local function git_sync(directory, url)
|
||||||
|
print("--- sync: " .. directory .. " ---")
|
||||||
|
end
|
||||||
|
|
||||||
|
local function git_pull(directory, url, ff_only)
|
||||||
|
print("--- pull: " .. directory .. " ---")
|
||||||
|
end
|
||||||
|
|
||||||
|
for directory, url in pairs(sync_mapping) do
|
||||||
|
git_sync(directory, url)
|
||||||
|
end
|
||||||
|
|
||||||
|
for directory, url in pairs(pull_mapping) do
|
||||||
|
git_pull(directory, url, true)
|
||||||
|
end
|
Loading…
Reference in a new issue