A simple and easy to use tool to run command when files change.
Easywatch is meant as an alternative to
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
ewatch -f '**/*.mklx' -- make
By default current directory is watched. To watch a different directories
and/or single files pass an option
ewatch -p 'document.mklx' -p 'text/' -f '**/*.mklx' -- make
Easywatch passes down to the command the
variable which contains a path to the changed file:
cat >hello_file.sh <<'EOF' #!/usr/bin/env sh echo "Hello $EWATCH_FILE_PATH!" EOF 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
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
ln -s "<easywatch repo>/target/release/easywatch" ~/local/.bin/ewatch