GithubHelp home page GithubHelp logo

cargo-watch's Introduction

$ cargo watch

Crate release version Crate license: CC0 1.0 Crate download count

Build status (Travis) Code of Conduct

Cargo Watch watches over your project's source for changes, and runs Cargo commands when they occur.

If you've used nodemon, gulp, guard, watchman, or similar others, it will probably feel familiar.

Install

$ cargo install cargo-watch

Or clone and build with $ cargo build then place in your $PATH.

Upgrade

Cargo has no easy upgrade mechanism at the moment, so you'll need to:

$ cargo uninstall cargo-watch
$ cargo install cargo-watch

Usage

By default, it runs test (which implies build). You can easily override this, though:

$ cargo watch [command...]

A few examples:

$ cargo watch doc
$ cargo watch test bench
$ cargo watch "build --release"
$ cargo watch "build --release" "test test_"

Cargo run

Cargo Watch has special behaviour with run commands: it will restart the process on file change. This works especially well when developing servers or other applications that never return on normal operation.

Details and tips

It pairs well with dybuk, the compiler output prettifier:

$ cargo watch check |& dybuk

Just like any Cargo command, it will run from any project subdirectory.

Cargo Watch will ignore everything that's not a Rust file, and files that start with either a dot (.foo.rs) or a tilde (~foo.rs).

It uses the notify crate for file events, so it supports all platforms, some more efficiently than others (if you use the big three — Linux, Mac, Windows — you will be fine).

If your Cargo Watch fails to watch some deep directories but not others, and you are on Linux, you may have hit the inotify watch limit. You can either increase the limit (instructions are on the previous link and at this Guard wiki page), or you can stop whatever it is that's consuming so many inotify watches.

Etc

Created by Félix Saparelli and awesome contributors.

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.