mirror of
https://github.com/zed-industries/zed.git
synced 2025-01-04 03:32:22 +03:00
Add an example executable for fsevents
This commit is contained in:
parent
0fd3f55730
commit
47f0b94d0c
16
fsevent/examples/events.rs
Normal file
16
fsevent/examples/events.rs
Normal file
@ -0,0 +1,16 @@
|
||||
use fsevent::EventStream;
|
||||
use std::{env::args, path::Path, time::Duration};
|
||||
|
||||
fn main() {
|
||||
let paths = args().skip(1).collect::<Vec<_>>();
|
||||
let paths = paths.iter().map(Path::new).collect::<Vec<_>>();
|
||||
assert!(paths.len() > 0, "Must pass 1 or more paths as arguments");
|
||||
let stream = EventStream::new(&paths, Duration::from_millis(100), |events| {
|
||||
eprintln!("event batch");
|
||||
for event in events {
|
||||
eprintln!(" {:?}", event);
|
||||
}
|
||||
true
|
||||
});
|
||||
stream.run();
|
||||
}
|
Loading…
Reference in New Issue
Block a user