-
Notifications
You must be signed in to change notification settings - Fork 51
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Export FILENAME as environment variable #40
Comments
From the readme: Pass the path and event details in to your custom command
|
Thank's @es128. I didn't notice that feature in the readme. I would however suggest that instead of replacing "{path}" in the command string like this:
...make the path and the event available as environment variables in the process running the command string. It's done by passing environment variables to the spawn function like this:
I think this is a bit more unix like way of making the variables available to the command process. If there's any interest, I'll be happy to create a pull request. |
@thomasfl I agree, using a random string template format is worse than using environment variables. I'll leave this open. I'm open to merge a PR which implements this. |
If you're going to replace the original templating with this, be mindful to release with a major version bump. |
@es128 yeah good point. Will do |
This was way more complicated than expected to implement. The spawn function is wrapped in four layers of lodash throttle magic. I was simply not able to figure out how to pass another variable to utils.run() from the watcher-loop. I suggest the environment variables are named FILEPATH and EVENT. |
I suggest making the updated FILENAME available as an environment variable from within the command. It makes is possible to run commands like this:
The very much similar filewatcher CLI, written in ruby, exports these environment variables:
Source: https://github.com/thomasfl/filewatcher
BTW! Chokidar seems to be a very good piece of software.
The text was updated successfully, but these errors were encountered: