aboutsummaryrefslogtreecommitdiff
path: root/bin/jfcd.sh
blob: 25bf03fd701c52ed46a4d5d7a851b3b828dbe932 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# Watch a directory for changes and commit them with jfc(1d) 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(1d) on the working
# directory
while inw ; do jfc ; done