2025-03-14 21:59:59 -06:00
|
|
|
# watchexec
|
|
|
|
|
|
|
|
|
|
> Run arbitrary commands when files change.
|
2025-05-08 12:26:01 -06:00
|
|
|
> More information: <https://manned.org/watchexec>.
|
2025-03-14 21:59:59 -06:00
|
|
|
|
|
|
|
|
- Call `ls -la` when any file in the current directory changes:
|
|
|
|
|
|
|
|
|
|
`watchexec {{ls -la}}`
|
|
|
|
|
|
|
|
|
|
- Run `make` when any JavaScript, CSS and HTML file in the current directory changes:
|
|
|
|
|
|
2025-05-08 12:26:01 -06:00
|
|
|
`watchexec {{[-e|--exts]}} {{js,css,html}} make`
|
2025-03-14 21:59:59 -06:00
|
|
|
|
|
|
|
|
- Run `make` when any file in the `lib` or `src` directory changes:
|
|
|
|
|
|
2025-05-08 12:26:01 -06:00
|
|
|
`watchexec {{[-w|--watch]}} {{lib}} {{[-w|--watch]}} {{src}} {{make}}`
|
2025-03-14 21:59:59 -06:00
|
|
|
|
|
|
|
|
- Call/restart `my_server` when any file in the current directory changes, sending `SIGKILL` to stop the child process:
|
|
|
|
|
|
2025-05-08 12:26:01 -06:00
|
|
|
`watchexec {{[-r|--restart]}} --stop-signal {{SIGKILL}} {{my_server}}`
|