From 683bb13e1637f5b0e8cf9493a0b42a6f6598c020 Mon Sep 17 00:00:00 2001 From: Petrus Repo Date: Fri, 6 Mar 2020 15:16:04 +0200 Subject: [PATCH] Document how to watch a directory --- README.md | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index aec6bc3..41a6bd4 100644 --- a/README.md +++ b/README.md @@ -11,10 +11,25 @@ Download `nightwatch` from [releases](https://github.com/jakolehm/nightwatch/rel ## Example Usage -``` +Single file: +```bash $ find *.js | nightwatch node app.js ``` +Watch everything in the current directory in a control loop: +```bash +COMMAND="bundle exec lolcat.rb" + +while true; do + if find . | nightwatch --debug --exit-on-change=255 --dir "${COMMAND}"; then + break # command wants to terminate, exit code was success + fi + + echo "Restart ${COMMAND}" + sleep 1 +done +``` + ## Building From Source ```