]> gitweb.fluxo.info Git - scripts.git/commitdiff
Fix: show: watch: subfolder support
authorSilvio Rhatto <rhatto@riseup.net>
Sun, 18 Apr 2021 14:09:25 +0000 (11:09 -0300)
committerSilvio Rhatto <rhatto@riseup.net>
Sun, 18 Apr 2021 14:09:25 +0000 (11:09 -0300)
show

diff --git a/show b/show
index 2815aad57cd258ef2130e2f8a3a8c0b17dabf9d4..aa8c5393d91cf43e430966b0b0edc040a2acb9ac 100755 (executable)
--- a/show
+++ b/show
@@ -12,6 +12,7 @@ LIST="$DOCS/$FILELIST"
 DOC_PATTERN=".*\.(txt|doc|docx|rtf|pdf|sxc|csv|odt|odf|ods|xls|xlsx|ppt|epub|mobi|djvu|lit)"
 FIND_OPTS="-not -path '*.git*' -regextype posix-egrep -iregex"
 ITEM="$1"
+OPTION="$2"
 DATE="`date +%s`"
 MAX_AGE="86400"
 
@@ -62,8 +63,14 @@ if [ "$ITEM" == "--search" ]; then
   grep -i -- "$*" $LIST
 elif [ "$ITEM" == "--watch" ]; then
   # Convert symlink to full path and start inotifywait loop
-  #while inotifywait -e modify -e create -e move -e delete -r "`readlink -f $DOCS`"; do
-  while inotifywait -e modify -e move -r "`readlink -f $DOCS`"; do
+  folder="`readlink -f $DOCS`"
+  subfolder="$OPTION"
+  echo "Watching changes at $folder/$subfolder..."
+
+  #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
 else