diff options
-rwxr-xr-x | bin/jfcd | 27 | ||||
-rw-r--r-- | man/man1/jfc.1 | 2 | ||||
-rw-r--r-- | man/man1/jfcd.1 | 16 |
3 files changed, 44 insertions, 1 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 diff --git a/man/man1/jfc.1 b/man/man1/jfc.1 index 8b5f9626..1c3c8400 100644 --- a/man/man1/jfc.1 +++ b/man/man1/jfc.1 @@ -11,6 +11,6 @@ with a stock message. This is for cases where you're tracking content and changes but don't need to care about being rigorous with commit messages. The author uses it for his ~/.remind files. .SH SEE ALSO -git(1) +git(1), jfcd(1) .SH AUTHOR Tom Ryder <tom@sanctum.geek.nz> diff --git a/man/man1/jfcd.1 b/man/man1/jfcd.1 new file mode 100644 index 00000000..9efa9d07 --- /dev/null +++ b/man/man1/jfcd.1 @@ -0,0 +1,16 @@ +.TH JFCD 1 "June 2016" "Manual page for jfcd" +.SH NAME +.B jfcd +\- watch a directory and automatically commit changes to it +.SH SYNOPSIS +.B jfcd +/path/to/dir & +.SH DESCRIPTION +.B jfcd +watches a directory recursively with inotifywait(1) and commits all changes +with jfc(1) as it detects them. It logs its output and errors to syslog using +logger(1). +.SH SEE ALSO +git(1), inotifywait(1), jfc(1), logger(1) +.SH AUTHOR +Tom Ryder <tom@sanctum.geek.nz> |