2 hours ago · Tech · 0 comments

For the next time I forget what this tool is called… entr (“event notify test runner”) is a neat little tool that monitors files and runs a command when they change. You can hit space to re-run the command even when the watched files haven’t changed, and exit by hitting q or Ctrl-C. I’ve been using it for over a decade now, and decided it’s worth documenting why! basic use case Run a test file whenever a source file changes! $ find . -name '*.ex' -o -name '*.exs' | entr mix test This looks for all the files in any subdirectories that end in .ex or exs, and runs mix test when any of them changes. running multiple commands piped or chained together Trying to run multiple commands using | or ; or && or || will not work as expected, because those character sequences get interpreted by the shell first. Instead, reach for the -s flag: $ ls package*.json | entr -crs 'npm install && npm start' …to watch the package.json and package-lock.json files in the current directory, and then npm…

No comments yet. Log in to reply on the Fediverse. Comments will appear here.