$ cargo build
.$ cargo watch
.It will watch your src
folder and any subdirectories for file changes,
additions, removals, and moves (in or out), and run both $ cargo build
and
$ cargo test
on your project. You can also specify other things to be run,
e.g. $ cargo doc
and $ cargo bench
, by passing flags.
See $ cargo watch --help
for more.
Just like any Cargo command, you can run it from any subdirectory in your project tree and it will find its way.
It's hard-coded to not compile things more than once per 2 seconds, to avoid
overloading your computer. It will also ignore everything that's not a Rust
file, everything that's a dot-file, and cache/backup files (.filename.swo
and ~filename.rs
).
It uses the notify crate for file events, so it supports Linux through inotify, and (untested) all other platforms through polling (and native solutions once they get there).
It uses notify to watch files, and
simply runs $ cargo <whatever>
as child processes.
I was getting tired of having to switch windows / tmux panes to compile my code. This is much faster, and because it shows the output of the command, I can see compile errors and warnings with a save and fix them immediately.
My name is FĂ©lix Saparelli a.k.a. passcod. You can find more about me on the internet.
Also a bunch of awesome contributors participated.