diff options
Diffstat (limited to '')
-rw-r--r-- | modules/common/hooks/default.nix | 8 | ||||
-rwxr-xr-x | modules/common/hooks/scripts/sync-git-repo.sh | 13 |
2 files changed, 21 insertions, 0 deletions
diff --git a/modules/common/hooks/default.nix b/modules/common/hooks/default.nix new file mode 100644 index 00000000..e2d12807 --- /dev/null +++ b/modules/common/hooks/default.nix @@ -0,0 +1,8 @@ +{ + pkgs, + lib, + config, +}: { + sync-git-repos = config.lib.taskwarrior.mkHook "on-add" [pkgs.git] ./scripts/sync-git-repo.sh; + sync-git-repos-mod = config.lib.taskwarrior.mkHook "on-modify" [pkgs.git] ./scripts/sync-git-repo.sh; +} diff --git a/modules/common/hooks/scripts/sync-git-repo.sh b/modules/common/hooks/scripts/sync-git-repo.sh new file mode 100755 index 00000000..ad7368f3 --- /dev/null +++ b/modules/common/hooks/scripts/sync-git-repo.sh @@ -0,0 +1,13 @@ +#!/usr/bin/env sh + +task_data="$(task _get rc.data.location)" +[ "$task_data" ] || die "Taskwarrior should have a location set" + +cd "$task_data" || die "(BUG?): Your data.location path is not accessable" + +[ -d ./.git/ ] || git init + +git add . +git commit --message="chore: Update" --no-gpg-sign + +# vim: ft=sh |