3 homepage: https://github.com/watchexec/watchexec
5 watchexec is a simple, standalone tool that watches a path and runs a command whenever it detects modifications.
8 To update or switch versions, run `webi watchexec@stable` (or `@v1.17`, `@beta`,
13 `watchexec` runs a given command when any files in watched directories change. \
14 It respects `.[git]ignore`.
16 Here's the shortlist of options we've found most useful:
19 -w, --watch ./src/ watch the given directory
20 -e, --exts js,css watch only the given extensions
21 -i, --ignore '*.md' do not watch the given pattern
22 -d, --debounce 5000 the minimum number of milleseconds
23 to wait between changes
25 -r, --restart restart the process (for servers, etc)
26 -s, --signal SIGHUP like -r, but with a signal (ex: SIGHUP)
27 -c, --clear clear the screen between command runs
28 -W (wait) ignore all changes as the command runs
30 -- npm start what command to run, with its arguments
32 --no-ignore disregard both .ignore and .gitignore
33 --no-vcs-ignore disregard only .gitignore
34 --no-default-ignore disregard built-in ignore lists
39 Example: List the directory when any files change.
42 watchexec -c -- ls -lah
45 ### Advanced Usage Example
47 Here's a "kitchen sink" example.
50 watchexec -c -r -s SIGKILL -d 2000 -W --verbose \
51 -w ./src -w ./server.js \
53 -i '*.md' -i 'package-lock.json' \
57 ### How to use (Node, Go, Rust, rsync)
59 These examples show how you might use this for builds, servers, and publishing
64 watchexec -W -- npm run build
65 watchexec -r -- npm start
68 watchexec -- go build .
69 watchexec -r -- go run .
72 watchexec -- cargo build --bin
73 watchexec -r -- cargo run --bin
76 watchexec -- rsync -avhP ./ ./srv/MY_PROJECT/
78 # rsync (remote publish)
79 watchexec -- rsync -avhP ./ app@example.com:~/srv/MY_PROJECT/