Watch a directory, file, or files for changes and run a command.
$ watch [-n] <path> [<cmd>...]
When multiple changes happen quickly changes are buffered and grouped into one event.
cmd
is ran once per event-n
splits the filenames of an event onto new lines. By default they are seperated by a colon.
$ watch Source/ make
$ watch js/ npm run build
$ watch -n js/ | xargs -I '%' cat %
$ make install
Compiling with Swift 3.1
Most watch utilites either poll on an interval or require complicated configuration. This uses FSEvents and has a simple api.