CLI wrapper for fsnotify
You probably want to use one of the following tools instead
Install
# Since Go 1.20.3
# "'go get' is no longer supported outside a module"
go install github.com/mozey/watcher@latest
Print version
$GOPATH/bin/watcher -version
Watch files, only output changes
$GOPATH/bin/watcher -dir testdata
Watch files recursively, and print debug logs
APP_DEBUG=true $GOPATH/bin/watcher -r -dir testdata
Recursively watch for change in both ./testdata
and ./testdata2
# APP_DIR env sets base dir
APP_DEBUG=true APP_DIR=$(pwd) go run ./main.go -r -dir testdata -dir testdata2
# Base dir set from flag
APP_DEBUG=true go run ./main.go -r -b $APP_DIR -dir testdata -dir testdata2
Using absolute path
cd ${PRO_PATH}/watcher # Base dir defaults to working dir
APP_DEBUG=true go run ./main.go -r \
-dir testdata \
-dir ${PRO_PATH}/watcher/testdata2
Example with filters
APP_DEBUG=true APP_DIR=$(pwd) go run ./main.go -r -dir testdata \
-include ".*.txt$" \
-include ".*.json$" \
-excludeDir ".*exclude.*" \
-exclude ".*\/d.txt$"
TODO See comments in main_test.go