diff --git a/src/usr/local/bin/autodoc b/src/usr/local/bin/autodoc index 4da2f9a..6699d98 100755 --- a/src/usr/local/bin/autodoc +++ b/src/usr/local/bin/autodoc @@ -15,7 +15,8 @@ g_lib=${g_bin/"bin"/"lib"} source "${g_lib}/globals" source "${g_lib}/logging" -source "${g_lib}/handle_inotify" +source "${g_lib}/main" + for plugin in "${g_lib}/plugins/"*".sh"; do source "${plugin}" done @@ -29,15 +30,4 @@ echo "Building everything in '${g_watchroot}'." do_build_all echo "Watching '${g_watchroot}'." -# setup inotify: -# -mrq monitor, recursive, quiet -# -e events -# --format %e eventlist csv, %w workdir, %f filename -inotifywait -mrq \ - -e create -e delete -e moved_to -e close_write \ - --format '%e %w%f' \ - "${g_watchroot}" | \ -\ -while read NOTIFICATION; do - do_handle ${NOTIFICATION} -done +do_build_watch diff --git a/src/usr/local/lib/autodoc/handle_inotify b/src/usr/local/lib/autodoc/main similarity index 89% rename from src/usr/local/lib/autodoc/handle_inotify rename to src/usr/local/lib/autodoc/main index bdfc845..d2ffd23 100644 --- a/src/usr/local/lib/autodoc/handle_inotify +++ b/src/usr/local/lib/autodoc/main @@ -1,7 +1,7 @@ #!/bin/bash # process an inotify event -do_handle() { # $FLAGS $OBJECT +do_handle_inotify() { # $FLAGS $OBJECT # extract params local flags="$1" shift 1 @@ -130,4 +130,19 @@ do_build_all() { # done } +do_build_watch() { # + # setup inotify: + # -mrq monitor, recursive, quiet + # -e events + # --format %e eventlist csv, %w workdir, %f filename + inotifywait -mrq \ + -e create -e delete -e moved_to -e close_write \ + --format '%e %w%f' \ + "${g_watchroot}" | \ + \ + while read NOTIFICATION; do + do_handle_inotify ${NOTIFICATION} + done +} + echo -n "main ... "