https://github.com/guangie88/rs-filewatch-trigger
FileWatch Trigger to run shell actions
https://github.com/guangie88/rs-filewatch-trigger
filewatcher rust shell trigger
Last synced: about 2 months ago
JSON representation
FileWatch Trigger to run shell actions
- Host: GitHub
- URL: https://github.com/guangie88/rs-filewatch-trigger
- Owner: guangie88
- License: mit
- Created: 2018-08-27T11:02:45.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2018-10-01T08:58:59.000Z (over 6 years ago)
- Last Synced: 2025-01-17T07:25:04.912Z (3 months ago)
- Topics: filewatcher, rust, shell, trigger
- Language: Rust
- Size: 34.2 KB
- Stars: 4
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# FileWatch Trigger
FileWatch Trigger application in Rust. The binary is named `fwt`.
The application watches for any type of file changes in the recursively watched
directory, and triggers the given action.Currently able to perform the following action(s):
- Run shell template command with path and event
## How to install
You may also choose to visit
[releases](https://github.com/guangie88/rs-filewatch-trigger/releases)
and download the latest version of statically built binary in the zip asset.Alternatively, if you have the `cargo` command, simply run
```bash
cargo install rs-filewatch-trigger
```## Example Command
For help:
```bash
fwt -h
```The following contains the help message:
```bash
USAGE:
fwt [FLAGS] [OPTIONS]FLAGS:
--force-poll Force using polling implementation, works for any platform
-h, --help Prints help information
--relative Use relative path instead of absolute path for path matches
-V, --version Prints version information
-v, --verbose Verbose mode (-v, -vv, -vvv)OPTIONS:
-d, --delay Delay interval in milliseconds between each file watch detection [default: 1000]
-e, --event Event type to trigger on (0=NONE, 1=CREATED, 2=DELETED, 4=MODIFIED, 8=MOVED) [default: 1]
-f, --filters Glob pattern(s) for file matching (comma delimited) [default: *.*]ARGS:
Directory path to watch recursiveSUBCOMMANDS:
cmd FileWatch Trigger to run various actions
help Prints this message or the help of the given subcommand(s)
```### Shell template command action
Assuming the current working directory is `/home/xxx`:
```bash
fwt -e 15 \
-f "*.jpg,*.png" \
-v \
. \
cmd --print-stdout "echo {path}: {event}"
```Example output:
```bash
/home/xxx/a.jpg: CREATED
```The following contains the help message for this action:
```bash
USAGE:
fwt cmd [FLAGS]FLAGS:
-h, --help Prints help information
--print-stderr Prints shell stderr to main stderr
--print-stdout Prints shell stdout to main stdout
-V, --version Prints version informationARGS:
Shell template command to run with string interpolation ({path}: triggered file path) ({event}: event
type number)
```