kota's memex

Rebuild project if sources change

ls | entr make

Using fd is often nicer since it will ignore .gitignore and such automatically:
fd | entr go run

Restarting services

entr adheres to the principle of separation of concerns, yet the reload (-r) option was added to solve a common use case that would otherwise require some careful scripting:
ls *.rb | entr -r ruby main.rb

Clear screen too!

Other special-purpose flags were added because they reduce highly repetitive actions or reduce friction. One of the most repetitive actions was to clear the screen before running tests; hence the -c flag:
ls -d * | entr -c ./test.sh

Refer to changed file

The special /_ argument (somewhat analogous to $_ in Perl) provides a quick way to refer to the first file that changed. When a single file is listed this is a handy way to avoid typing a pathname twice:
ls *.sql | entr psql -f /_

Watching for New Files

The directory watch option (-d) was added to react to events when a new file is added to a directory. Since entr relies on standard input piped from other Unix tools, an external shell loop must be used to rescan the file system. One way to implement this feature would be to simply require the users to list directories, but entr will infer the directories if they aren't listed explicitly:\

while true; do
  ls -d src/*.py | entr -d ./setup.py
done

TUI Programs

entr sadly doesn't have support for tui programs out of the box due to the way -r was implemented. This may be fixed someday, but it's certainly not a simple fix. In the meantime I've just done this shitty hack to spawn a new terminal running the program lmfao:
fd -e go | entr -cr alacritty --class "Alacritty-float,Alacritty-float" -o window.position.x=1380 -o window.position.y=82 -e go run .