Site Tools


cli:entr

entr cheatsheet

  • -c – Clear screen
  • -d – Track directories that do not start with ., new file causes entr to stop, so wrap it with while loop
  • -p – delay execution until files change event
  • -r – Kill previously run command before executing command
  • -s – Use shell on first argument
trigger on changed files
git status --porcelain | awk '{print $2}' | entr -c -r node app.js
reload nodejs app
ls *.js | entr -c -r node app.js
Rebuild project if a source file is modified or added to the src/ directory
# bash
while true; do find ./src -iname '*.js' | entr -d node app.js; done

# fish
while true; find . -iname "*.py" | entr -rdc poetry run test; end

references:

cli/entr.txt · Last modified: 2021-05-16 by dcai