From b3a7e36c374a8f10b100737bbaeca45844c9c234 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Petazzoni?= Date: Fri, 13 Oct 2017 19:23:00 +0200 Subject: [PATCH] fixup build.sh script --- docs/build.sh | 32 +++++++++++++++++++++++--------- 1 file changed, 23 insertions(+), 9 deletions(-) diff --git a/docs/build.sh b/docs/build.sh index 541b4ae7..d2729e73 100755 --- a/docs/build.sh +++ b/docs/build.sh @@ -1,11 +1,25 @@ #!/bin/sh - -for YAML in *.yml; do - ./markmaker.py < $YAML > $YAML.html || rm $YAML.html -done - -if [ "$1" = "watch" ]; then - while true; do - find . | entr -d $0 && break +case "$1" in +once) + for YAML in *.yml; do + ./markmaker.py < $YAML > $YAML.html || rm $YAML.html done -fi + ;; + +forever) + # There is a weird bug in entr, at least on MacOS, + # where it doesn't restore the terminal to a clean + # state when exitting. So let's try to work around + # it with stty. + STTY=$(stty -g) + while true; do + find . | entr -d $0 once + [ $? = 2 ] || break + done + stty $STTY + ;; + +*) + echo "$0 " + ;; +esac