2020-05-27 19:47:48 +00:00
|
|
|
# watchexec
|
|
|
|
|
|
|
|
> Run arbitrary commands when files change.
|
2025-04-22 15:48:30 +03:00
|
|
|
> More information: <https://manned.org/watchexec>.
|
2020-05-27 19:47:48 +00:00
|
|
|
|
|
|
|
- Call `ls -la` when any file in the current directory changes:
|
|
|
|
|
2023-08-23 08:55:18 +02:00
|
|
|
`watchexec {{ls -la}}`
|
2020-05-27 19:47:48 +00:00
|
|
|
|
2023-08-23 08:55:18 +02:00
|
|
|
- Run `make` when any JavaScript, CSS and HTML file in the current directory changes:
|
2020-05-27 19:47:48 +00:00
|
|
|
|
2025-04-22 15:48:30 +03:00
|
|
|
`watchexec {{[-e|--exts]}} {{js,css,html}} make`
|
2020-05-27 19:47:48 +00:00
|
|
|
|
2023-08-23 08:55:18 +02:00
|
|
|
- Run `make` when any file in the `lib` or `src` directory changes:
|
2020-05-27 19:47:48 +00:00
|
|
|
|
2025-04-22 15:48:30 +03:00
|
|
|
`watchexec {{[-w|--watch]}} {{lib}} {{[-w|--watch]}} {{src}} {{make}}`
|
2020-05-27 19:47:48 +00:00
|
|
|
|
2023-08-23 08:55:18 +02:00
|
|
|
- Call/restart `my_server` when any file in the current directory changes, sending `SIGKILL` to stop the child process:
|
2020-05-27 19:47:48 +00:00
|
|
|
|
2025-04-22 15:48:30 +03:00
|
|
|
`watchexec {{[-r|--restart]}} --stop-signal {{SIGKILL}} {{my_server}}`
|