diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2016-06-30 00:14:24 +1200 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2016-06-30 00:14:24 +1200 |
commit | b2a26a735646bf03fb6db62bf9c23b2d509bf9fa (patch) | |
tree | a0646f544aac7391c4ac850ee0ccd6cb300bb821 /bin/jfcd | |
parent | Extend jfc(1) to check for changes before commit (diff) | |
download | dotfiles-b2a26a735646bf03fb6db62bf9c23b2d509bf9fa.tar.gz dotfiles-b2a26a735646bf03fb6db62bf9c23b2d509bf9fa.zip |
Add jfcd(1)
Diffstat (limited to 'bin/jfcd')
-rwxr-xr-x | bin/jfcd | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/bin/jfcd b/bin/jfcd new file mode 100755 index 00000000..3bc77af1 --- /dev/null +++ b/bin/jfcd @@ -0,0 +1,27 @@ +#!/usr/bin/env bash + +# jfcd(1) -- Watch a directory for changes and commit them with jfc(1) if there +# are any +self=jfcd + +# Check we have what we need +hash inotifywait jfc || exit + +# Function wrapper around inotifywait(1) +inw() { + inotifywait \ + @./.git \ + -e create -e delete -e modify -e move \ + --recursive \ + --syslog \ + . | + logger --tag "$self" +} + +# Drectory to check is first and only argument; move into it +dir=${1:?} +cd -- "$dir" || exit + +# Run a while loop over inotifywait(1) calls, running jfc(1) on the working +# directory +while inw ; do jfc ; done |