monzilla_rs

Crates.iomonzilla_rs
lib.rsmonzilla_rs
version1.0.0
sourcesrc
created_at2023-04-29 21:04:56.336322
updated_at2023-04-29 21:04:56.336322
descriptionMonzilla file monitor
homepage
repositoryhttps://github.com/jlyonsmith/monzilla_rs
max_upload_size
id852301
size48,952
John Lyon-Smith (jlyonsmith)

documentation

README

Monzilla

coverage Crates.io Docs.rs

An uncomplicated file monitoring tool. It runs a program then watches the files you specify for changes, restarting the program if the files change. You can also manually restart the program. If you need more power I suggest Watchman.

Installation

Install the command line tool with:

cargo install monzilla_rs

Then you can run it with something like the following:

monzilla -g 'scratch/*.fish' 'scratch/xyz.json5' -- scratch/forever.fish

Any time the files change the program will be killed and restarted.

Points of Interest

This tool shows how to do a variety of advanced things in Rust:

  • How to use termios to capture CTRL+C and CTRL+R from the terminal
  • Using crossbeam and select to wait on multiple channels
  • How to use the notify to watch for file changes with with debouncing of multiple changes at once.
  • Using command-group to group child processes so you can terminate the entire tree not just the immediate child process.

Plus, all the good stuff found in my rust_cli_quickstart.

Commit count: 7

cargo fmt