Actually the name entr is an acronym for Event Notify Test Runner and has nothing to do with the word enter, but I always associate entr with it, because it helps me to get rid off of many ALT-TAB and ENTER strokes.
There are ready-to-install packages for Debian and Ubuntu. This packages can be installed with
apt-get install entr. If you are on MacOS you can install it via Homebrew with
brew install entr.
Entr uses kqueue or inotify to detect changes. So it doesen’t poll files periodically. Furthermore it listen to the file system events.
The syntax is pretty intuitive. First the files should be selected, which will be changed. The locations of the files will be passed to entr. Entr takes commands, which should be executed, as a parameter. Abstracted it looks like this:
[files] | entr [command]
here numerous of tasks, for which entr can be used. When you are mocking up a design of a website for example or writing a LaTeX document. Also to realise continue testing can be done with entr.
Imagine you are writing a LaTeX document. So you can just rebuild it everytime you save a .tex-file by running entr like this:
ls *.tex | entr pdflatex document.tex
Another use case I found recently is, when I was writing an XML schema for a XML document. I wanted to validate it each time I saved the .xsd-file. Of course you could use a fancy XML editor, which displays errors, but it’s quite easy to do this with entr, too!
With xmllint XML can be validated. On Debian and Ubuntu you get it by installing the package
libxml2-utils, while on MacOSx it’s even pre-installed. With that tools set up, you can use entr like that:
ls schema.xsd document.xml | entr xmllint -schema schema.xsd document.xml
One of the biggest advantages of entr is, that it runs on BSD-based and Linux systems. Another is that entr is analyzing the events and is filtering them to prevent unwanted triggers.
About what use cases for entr can you think about? Did you like this blog post?