2018-11-26 18:11:43 +00:00
|
|
|
# entr
|
|
|
|
|
|
|
|
> Run arbitrary commands when files change.
|
2024-03-01 16:48:17 +00:00
|
|
|
> More information: <http://eradman.com/entrproject/>.
|
2018-11-26 18:11:43 +00:00
|
|
|
|
2019-02-11 18:00:49 +00:00
|
|
|
- Rebuild with `make` if any file in any subdirectory changes:
|
2018-11-26 18:11:43 +00:00
|
|
|
|
|
|
|
`{{ag -l}} | entr {{make}}`
|
|
|
|
|
|
|
|
- Rebuild and test with `make` if any `.c` source files in the current directory change:
|
|
|
|
|
|
|
|
`{{ls *.c}} | entr {{'make && make test'}}`
|
|
|
|
|
|
|
|
- Send a `SIGTERM` to any previously spawned ruby subprocesses before executing `ruby main.rb`:
|
|
|
|
|
|
|
|
`{{ls *.rb}} | entr -r {{ruby main.rb}}`
|
|
|
|
|
|
|
|
- Run a command with the changed file (`/_`) as an argument:
|
|
|
|
|
|
|
|
`{{ls *.sql}} | entr {{psql -f}} /_`
|
2024-03-01 16:48:17 +00:00
|
|
|
|
|
|
|
- [c]lear the screen and run a query after the SQL script is updated:
|
|
|
|
|
|
|
|
`{{echo my.sql}} | entr -cp {{psql -f}} /_`
|
|
|
|
|
|
|
|
- Rebuild the project if source files change, limiting output to the first few lines:
|
|
|
|
|
|
|
|
`{{find src/}} | entr -s {{'make | sed 10q'}}`
|
|
|
|
|
|
|
|
- Launch and auto-[r]eload a Node.js server:
|
|
|
|
|
|
|
|
`{{ls *.js}} | entr -r {{node app.js}}`
|