~sircmpwn/wersh

0d248590f98151161c21da784599ac034950e091 — Drew DeVault 2 years ago 18c1195 master
Add wersh-watch
3 files changed, 21 insertions(+), 0 deletions(-)

M Makefile
M wersh
A wersh-watch
M Makefile => Makefile +1 -0
@@ 4,3 4,4 @@ DESTDIR?=$(PREFIX)
install: wersh wersh.awk
	install -Dm755 wersh $(DESTDIR)/bin/wersh
	install -Dm755 wersh.awk $(DESTDIR)/bin/wersh.awk
	install -Dm755 wersh-watch $(DESTDIR)/bin/wersh-watch

M wersh => wersh +2 -0
@@ 75,6 75,8 @@ else
    then
        echo "$_outputdir exists and is not a directory"
        exit 1
    else
        rm -rf $_outputdir
    fi
    find "$root" -type f -name "*.w" -not -path "*/_*/*" -not -name "_*" -not -path "/.*" | \
    while IFS= read -r _input

A wersh-watch => wersh-watch +18 -0
@@ 0,0 1,18 @@
#!/bin/sh
if ! which inotifywait > /dev/null 2>&1
then
    echo "inotifywait is not installed." >&2
    echo "Note: this script is Linux-specific." >&2
    exit 1
fi

wersh "$@"
echo "Waiting for changes..."
while inotifywait -r \
    --exclude "_site/.*" \
    -e modify,move,create,delete \
    .
do
    echo "Waiting for changes..."
    wersh "$@"
done