aboutsummaryrefslogtreecommitdiff
path: root/bin/jfcd
blob: b5fff5a130840a67fb5e2d3a38eae1692f86f7fe (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/bin/sh

# Watch a directory for changes and commit them with jfc(1) if there are any;
# requires inotifywait(1)
self=jfcd

# Function wrapper around inotifywait(1)
inw() {
    inotifywait \
        @./.git \
        -e create -e delete -e modify -e move \
        --recursive \
        --syslog \
        . |
        logger --tag "$self"
}

# Directory to check is first and only argument; defaults to current directory
cd -- "${1:-.}" || exit

# Run a while loop over inotifywait(1) calls, running jfc(1) on the working
# directory
while inw ; do jfc ; done