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 ### Updating `watchexec`
10 `webi watchexec@stable`
12 Use the `@beta` tag for pre-releases.
16 `watchexec` runs a given command when any files in watched directories change. \
17 It respects `.[git]ignore`.
19 Here's the shortlist of options we've found most useful:
22 -w, --watch ./src/ watch the given directory
23 -e, --exts js,css watch only the given extensions
24 -i, --ignore '*.md' do not watch the given pattern
25 -d, --debounce 5000 the minimum number of milleseconds
26 to wait between changes
28 -r, --restart restart the process (for servers, etc)
29 -s, --signal SIGHUP like -r, but with a signal (ex: SIGHUP)
30 -c, --clear clear the screen between command runs
31 -W (wait) ignore all changes as the command runs
33 -- npm start what command to run, with its arguments
35 --no-ignore disregard both .ignore and .gitignore
36 --no-vcs-ignore disregard only .gitignore
37 --no-default-ignore disregard built-in ignore lists
42 Example: List the directory when any files change.
45 watchexec -c -- ls -lah
48 ### Advanced Usage Example
50 Here's a "kitchen sink" example.
53 watchexec -c -r -s SIGKILL -d 2000 -W --verbose \
54 -w ./src -w ./server.js \
56 -i '*.md' -i 'package-lock.json' \
60 ### How to use (Node, Go, Rust, rsync)
62 These examples show how you might use this for builds, servers, and publishing
67 watchexec -W -- npm run build
68 watchexec -r -- npm start
71 watchexec -- go build .
72 watchexec -r -- go run .
75 watchexec -- cargo build --bin
76 watchexec -r -- cargo run --bin
79 watchexec -- rsync -avhP ./ ./srv/MY_PROJECT/
81 # rsync (remote publish)
82 watchexec -- rsync -avhP ./ app@example.com:~/srv/MY_PROJECT/