IF a filesystem event (create, write, remove, chmod) occurs in a watched folder that is not filtered out by an exclusion rule THEN execute a shell command.
Use this to watch for code changes to trigger: process restart; code compilation; or test run.
You'll need rust installed on your machine.
cargo install ifft
Create a config file (ifft_config.toml
):
```toml
root = "~/src"
not = [ "~", ".swp", ]
[[ifft]]
if = "my-c-prog/*/.{c,h}" then = "make" working_dir = "my-c-prog"
[[ifft]] if = "my-rust-prog/*"
not = ["my-rust-prog/target/*"] then = "cargo build" working_dir = "my-rust-prog"
[[ifft]]
then = "cp -R {{}} ."
working_dir = "/tmp" ```
Run ifft
:
bash
ifft path/to/ifft_config.toml
Output:
ifft
is verbose for easy debugging. Triggers report the match condition and
the exit code, stdout, and stderr of the triggered command:
[2019-01-31 04:51:28Z] Event: Create("/home/ken/src/my-rust-prog/src/main.rs")
Matched if-cond: "my-rust-prog/*"
Executing: "cargo build" from "/home/ken/src/my-rust-prog"
Exit code: 0
Stdout:
Stderr:
Compiling my-rust-prog v0.1.0 (/home/ken/src/my-rust-prog)
Finished dev [unoptimized + debuginfo] target(s) in 0.27s
[2019-01-31 04:51:28Z] Event: Create("/home/ken/src/my-rust-prog/target/debug/incremental/my_rust_prog-1m194buzrsqka/s-f91jk9lg3a-wlnrr5.lock")
[2019-01-31 04:51:28Z] Event: Write("/home/ken/src/my-rust-prog/target/debug/deps/my_rust_prog-b5f4d74ed1175a94.d")
toml
file.if
and not
conditions.root
as an absolute path independent from if
conditions as relative paths.root
supports shell expansion: ~
and environment variables.not
filtering and per-trigger not
filtering.Tested on Linux and OS X. Untested elsewhere.
On the guest OS, VirtualBox Shared Folders do not generate filesystem event notifications. You'll need to use a separate filesystem event forwarder such as notify-forwarder.
.gitignore
parsing support.