Skip to content

Commit

Permalink
Implement variable replacement in command
Browse files Browse the repository at this point in the history
Uses {path} as the replacement string instead of $path, since the
latter was already replaced by local environment’s $PATH in zsh by the
time the args reached chokidar-cli. Providing {event} as well in case
anyone ever needs it.

Resolves #11
  • Loading branch information
es128 committed Nov 18, 2015
1 parent 9305c66 commit cef99d3
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,11 @@ function startWatching(opts) {

// TODO: commands might be still run concurrently
if (opts.command) {
debouncedRun(opts.command);
debouncedRun(
opts.command
.replace(/\{path\}/ig, path)
.replace(/\{event\}/ig, event)
);
}
});

Expand Down

0 comments on commit cef99d3

Please sign in to comment.