doowb / watch-cli

Watch files and execute an npm script when files change.
MIT License
60 stars 10 forks source link

Make environment variables FILENAME and EVENT available from command #8

Closed thomasfl closed 7 years ago

thomasfl commented 7 years ago

Environment variables available from the command string:

FILENAME           Relative filename.
ABSOLUTE_FILENAME  Asolute filename.
EVENT              Event type. Is either 'changed', 'deleted' or 'added'.

Use it like this in Linux/macOS:

$ watch -p '**/*.js' -c 'jshint $FILENAME'

In Windows:

> watch -p "**/*.js" -c "jshint %FILENAME%"

This feature was copied from my Ruby gem filewatcher https://github.com/thomasfl/filewatcher

doowb commented 7 years ago

Thanks for the PR! I'll get this published soon.

orzechowskid commented 7 years ago

any chance this could be published to npm soon? I'd love to use this in an app I'm building but putting a Git repo link in my package.json is a little gross. Thanks!

doowb commented 7 years ago

Done! thanks for the ping. I thought I had published it.