Giter Club home page Giter Club logo

cargo-watch's Introduction

$ 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.

cargo-watch's People

Contributors

passcod avatar neuschaefer avatar aij avatar detegr avatar kstep avatar compressed avatar aigeruth avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.