cargo-watch 3.0.1

Utility for cargo to compile projects when sources change
cargo-watch-3.0.1 is not a library.
Visit the last successful build: cargo-watch-7.7.1

$ cargo watch

ReleaseLicenseTravisCode of Conduct

Usage

  1. Build with $ cargo build.
  2. Place in your $PATH.
  3. Invoke using $ cargo watch.

screenshot from 2014-12-21 15 09 10

What?

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 $ cargo watch doc bench or more sophisticated cargo commands such as $ cargo watch "build --release" "test test_" which will send those two commands to cargo. 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, OS X, and soon Windows through native APIs, and has a polling implementation to fall back on for all other platforms.

How?

It uses notify to watch files, and simply runs $ cargo <whatever> as child processes.

Why?

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.

Who?

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.