A simple and easy to use tool to run command when files change
b0adb1b8 — Cezary Drożak 2 years ago
Merge branch 'v1.1'
009fa3d2 — Cezary Drożak 2 years ago
fix: don't canonicalize path
15128236 — Cezary Drożak 2 years ago
Merge branch 'v1.1'



You can also use your local clone with git send-email.


A simple and easy to use tool to run command when files change.

Easywatch is meant as an alternative to inotifywait or entr, but has deliberately as little options as possible and does not require writing complicated scripts. It is based on Notify library.


Run with the command specified after double hyphen -- to recursively watch all files in the current directory:

ewatch -- make


You can specify one or more glob patterns to filter files with, using option -f or --format:

ewatch -f '**/*.mklx' -- make


By default current directory is watched. To watch a different directories and/or single files pass an option -p or --path:

ewatch -p 'document.mklx' -p 'text/' -f '**/*.mklx' -- make

#EWATCH_FILE_PATH environment variable

Easywatch passes down to the command the EWATCH_FILE_PATH environment variable which contains a path to the changed file:

cat >hello_file.sh <<'EOF'
#!/usr/bin/env sh
echo "Hello $EWATCH_FILE_PATH!"
chmod +x hello_file.sh

ewatch -f '*.txt' -- ./hello_file.sh &

touch test.txt
# Hello <working directory>/./test.txt!


Easywatch can be built by calling cargo build --release. It will generate the easywatch binary in target/release directory. A symbolic link can then be created in some directory that is available in the $PATH. In my case it is ~/local/.bin:

ln -s "<easywatch repo>/target/release/easywatch" ~/local/.bin/ewatch