Watch a Folder and Run a Process when Things Change with watchexe
Use watchexec to watch files in a directory and run a process when they change.
Basic Example
watchexec -c -r -e py,html ./process.py
Details
-
-cclears the screen before each run -
-rkills and restarts the process if it's still running -
-e ext1,etc2sets the file extensions to watch
Notes
-
watchexec does some shenanigans with looking for parent git repos to determine which directory to start watching in.
TODO: Add more notes about the root directory that gets watched and how to change it if necessary.