Only watch if 'watch' passed as argument
parent
079a581c69
commit
68209baa77
|
@ -45,21 +45,24 @@ fn build() {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
println!("Watching...\n");
|
|
||||||
|
|
||||||
use notify::*;
|
|
||||||
|
|
||||||
let (tx, rx) = std::sync::mpsc::channel();
|
|
||||||
|
|
||||||
let mut watcher = watcher(tx, Duration::from_millis(100)).unwrap();
|
|
||||||
build();
|
build();
|
||||||
|
|
||||||
watcher.watch("./src", RecursiveMode::Recursive).unwrap();
|
if matches!(std::env::args().nth(1).as_deref(), Some("watch")) {
|
||||||
|
use notify::*;
|
||||||
|
|
||||||
loop {
|
let (tx, rx) = std::sync::mpsc::channel();
|
||||||
match rx.recv() {
|
|
||||||
Ok(_) => build(),
|
let mut watcher = watcher(tx, Duration::from_millis(100)).unwrap();
|
||||||
Err(_) => break,
|
watcher.watch("./src", RecursiveMode::Recursive).unwrap();
|
||||||
|
|
||||||
|
println!();
|
||||||
|
log_info("Watching…\n");
|
||||||
|
|
||||||
|
loop {
|
||||||
|
match rx.recv() {
|
||||||
|
Ok(_) => build(),
|
||||||
|
Err(_) => break,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue