]> gitweb.fluxo.info Git - scripts.git/commitdiff
Fix: show: use inotifier for the --watch option
authorSilvio Rhatto <rhatto@riseup.net>
Sat, 3 Aug 2024 02:57:34 +0000 (23:57 -0300)
committerSilvio Rhatto <rhatto@riseup.net>
Sat, 3 Aug 2024 02:57:34 +0000 (23:57 -0300)
show

diff --git a/show b/show
index af73a9d34de94baf2d7f38757e7351dfc86f377c..a2a118c0d65de252202925fce30949f4d9f34794 100755 (executable)
--- a/show
+++ b/show
@@ -44,8 +44,10 @@ if [ -z "$ARG" ]; then
   echo "       $BASENAME --watch          <subfolder>"
   echo "       $BASENAME                  <item-name>"
   exit 1
+
 elif [ "$ARG" == "--refresh" ]; then
   __update_filelist
+
 elif [ ! -d "$DOCS" ]; then
   echo "missing $DOCS folder"
   exit 1
@@ -69,6 +71,7 @@ fi
 if [ "$ARG" == "--search" ]; then
   shift
   grep -i -- "$*" $LIST
+
 elif [ "$ARG" == "--details" ]; then
   shift
   entry="`echo $* | sed -e 's/^@//'`"
@@ -82,6 +85,7 @@ elif [ "$ARG" == "--details" ]; then
   else
     find $DOCS -name ${1}.bib -exec cat {} \;
   fi
+
 elif [ "$ARG" == "--watch" ]; then
   # Convert symlink to full path and start inotifywait loop
   folder="`readlink -f $DOCS`"
@@ -91,9 +95,11 @@ elif [ "$ARG" == "--watch" ]; then
   #while inotifywait -e modify -e create -e move -e delete -r "$folder"; do
   #while inotifywait -e modify -e move -r "$folder"; do
   #while inotifywait -e modify -e move -r "$folder/$subfolder"; do
-  while inotifywait -e modify -e create -e move -e delete -r "$folder/$subfolder"; do
-    $PROGRAM --refresh
-  done
+  #while inotifywait -e modify -e create -e move -e delete -r "$folder/$subfolder"; do
+  #  $PROGRAM --refresh
+  #done
+  inotifier $PROGRAM --refresh
+
 else
   shift 2
   EXTRA_ARGS="$*"