Another wonderful tool is "entr". It just runs a program when files change.
It's incredible.
I use it 20-40 times an hour to do very fast Dev/DevOps development:
- "run Pytest when Python files change" - "I forgot how to use ps, run my-ps.sh when it changes and show me the output" - "rebuild all these Kubernetes resources when I edit the YAML files" - "run fast lint, then unit test Python files, then invoke one and show me the results"
I use https://watchexec.github.io/ for this, which looks similar. Anyone who tried both and knows which one is better?
There's another one that I've used that is written in go: https://github.com/cespare/reflex
I am inclined to use watchexec next time I need one, because like go, I can read it more easily than c, but also because I looked at the web page and GitHub repo and it seems worth trying. For instance, it shows how to use it as a library instead of just as a command-line tool. https://watchexec.github.io/