1.0.0 • Published 3 years ago
exat v1.0.0
exat - an essential tool to react on file system events
It's a tiny utility which just listen to file system events(like add/update/remove) and run some command once the such event is triggered.
Installation
- Install the exat utility via npm/yarn:
$ yarn global add exat
# -or-
$ npm i -g exat
Usage (example)
- Run the exat in any empty directory:
$ exat --filter=newfile.txt rm newfile.txt
- Trigger file system change in another terminal:
$ touch newfile.txt
- Make sure that the 'rm filename' command was executed:
$ cat newfile.txt
cat: can't open 'newfile.txt': No such file or directory
The 'exat' supports the next options:
-t --timeout - when the timeout is reached, shutdown without the command execution
-p --poll - use operating system(nix/macos) facilities to be notified about file system events
-i --ignore - use simple pattern to ignore some paths
-f --filter - use regex to filter paths which could cause command execution
The rest arguments will be assumed as the command and its arguments. All stdin/stdout/stderr streams is piped from/to the child process. The child process exit code will be forwarded as an exit code of the 'exat'.
License
MIT License - see the LICENSE for more details.