#file-watcher #file #watcher #execute-command #cli #async

app fswatcher

A file system watcher that executes a command when a specified file changes

2 unstable releases

new 0.3.0 Feb 18, 2025
0.2.1 Feb 18, 2025

#218 in Filesystem

43 downloads per month

MIT license

15KB
214 lines

fswatcher

Crates.io License Downloads

📌 Overview

fswatcher is a simple CLI tool to monitor file changes and execute a command when modifications are detected. It is built with Rust and utilizes the notify crate for efficient filesystem event watching.

🚀 Installation

You can install fswatcher using Cargo:

cargo install fswatcher

🛠 Usage

Run fswatcher by specifying a file to watch and a command to execute when the file changes:

fswatcher <file> <command>

Example:

fswatcher config.yaml 'echo "Config changed!"'

This will monitor config.yaml and print "Config changed!" whenever the file is modified.

✨ Features

  • Watches a specified file for changes
  • Executes a command automatically upon file modification
  • Uses a lock mechanism to prevent same command duplicate execution

🔧 Development

Clone the repository and build locally:

git clone https://github.com/jmarcelomb/fswatcher.git
cd fswatcher
cargo build --release

Run the tool with:

cargo run -- <file> <command>

📜 License

This project is licensed under the MIT License - see the LICENSE file for details.

🙌 Contribution

Contributions, issues, and feature requests are welcome! Feel free to open an issue or submit a pull request.


Created by Marcelo Borges.

Dependencies

~6–15MB
~189K SLoC