watchexec
Executes commands in response to file modifications
What is watchexec?
Executes commands in response to file modifications
Overview of watchexec
What it is
Watchexec is a simple, standalone tool that watches a path and runs a command whenever it detects modifications. It is designed to automate repetitive tasks during software development.
Key features
- Simple invocation and use, does not require a cryptic command line involving
xargs - Runs on OS X, Linux, and Windows
- Monitors current directory and all subdirectories for changes
- Coalesces multiple filesystem events into one, for editors that use swap/backup files during saving
- Loads
.gitignoreand.ignorefiles - Uses process groups to keep hold of forking programs
- Provides the paths that changed in environment variables or STDIN
- Does not require a language runtime, not tied to any particular language or ecosystem
Use cases
- Automatically run unit tests
- Run linters/syntax checkers
- Rebuild artifacts
- Watch JavaScript, CSS, and HTML files and run
npm run buildon changes - Restart a Python server when Python files change
Getting started
Quick start examples:
$ watchexec -e js,css,html npm run build
$ watchexec -r -e py -- python server.py
Install options:
- With your package manager for Arch, Debian, Homebrew, Nix, Scoop, Chocolatey…
- From binary with Binstall:
cargo binstall watchexec-cli - As pre-built binary package from Github
- From source with Cargo:
cargo install --locked watchexec-cli
License and pricing
Licensed under Apache-2.0. Open source and free to use.
Based on the project's public README and repository metadata.