aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2021-04-15 08:14:38 -0300
committerSilvio Rhatto <rhatto@riseup.net>2021-04-15 08:14:38 -0300
commit6a1add686c7b5b1dccdb2a9c3a9334fd8e030d68 (patch)
tree1c71def0e1073045e26478cb3723f450d395a9ff
parent9151606d519de344abb07f26eacc833be73e6732 (diff)
downloadscripts-6a1add686c7b5b1dccdb2a9c3a9334fd8e030d68.tar.gz
scripts-6a1add686c7b5b1dccdb2a9c3a9334fd8e030d68.tar.bz2
Feat: show: inotify watch support
-rwxr-xr-xshow9
1 files changed, 9 insertions, 0 deletions
diff --git a/show b/show
index 4be01ac..2195702 100755
--- a/show
+++ b/show
@@ -4,6 +4,7 @@
#
# Parameters
+PROGRAM="$0"
BASENAME="`basename $0`"
DOCS="$HOME/data/doc"
FILELIST=".filelist"
@@ -59,6 +60,14 @@ fi
if [ "$ITEM" == "--search" ]; then
shift
grep -i -- "$*" $LIST
+elif [ "$ITEM" == "--watch" ]; then
+ (
+ cd $DOCS
+
+ while inotifywait -e modify -e create -e move -e delete .; do
+ $PROGRAM --refresh
+ done
+ )
else
grep -i -- "$ITEM" $LIST | while read entry; do
echo "Opening $entry..."