| Crates.io | t2 |
| lib.rs | t2 |
| version | 1.0.0 |
| created_at | 2025-12-14 02:51:34.6061+00 |
| updated_at | 2025-12-14 02:51:34.6061+00 |
| description | Rerun commands when files change - Rust file watcher |
| homepage | |
| repository | https://github.com/keitheis/t2 |
| max_upload_size | |
| id | 1983686 |
| size | 37,705 |
A fast, efficient file watcher written in Rust that automatically reruns commands when files change.
t2 is a Rust implementation of the file watcher. It watches files for changes and automatically reruns specified commands, making it perfect for development workflows where you need to rebuild, retest, or recompile after code changes.
notify crate for efficient OS-level file system events (no polling!)cargo install --path .
cargo build --release
The binary will be at target/release/t2.
t2 'command' [monitor_path [monitored_path...]]
Watch Rust files and run tests:
t2 'cargo test' src/
Watch markdown files and rebuild docs:
t2 'make docs' *.md docs/
Watch multiple directories:
t2 'npm run build' src/ static/ templates/
t2 automatically ignores changes to these file types:
.pyc.swp, .swo.bmp, .jpg, .jpeg, .png, .gif, .svg, .psd, .xcf, .pxm$ t2 'echo "Building..."' src/
t2 is watching about 8 files:
src/
FIGHT!
echo "Building..."
Building...
CONTINUE?
src/main.rs changed
FIGHT!
echo "Building..."
Building...
CONTINUE?
^CGAMEOVER
cargo test
cargo build
cargo build --release
t2/
├── Cargo.toml # Project configuration
├── src/
│ ├── main.rs # Entry point and orchestration
│ ├── filter.rs # File ignore patterns
│ ├── scanner.rs # File discovery
│ ├── executor.rs # Command execution
│ ├── watcher.rs # Event-based file watching
└── tests/
└── integration_tests.rs # Integration tests
MIT License
Keith Yang yang@keitheis.org