Categorygithub.com/mozey/watcher
repositorypackage
0.2.0
Repository: https://github.com/mozey/watcher.git
Documentation: pkg.go.dev

# Packages

No description provided by the author

# README

watcher

CLI wrapper for fsnotify

Quick start

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

Testing

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