diff options
-rw-r--r-- | src/main.rs | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/main.rs b/src/main.rs index f6aec5c..d3b8872 100644 --- a/src/main.rs +++ b/src/main.rs @@ -104,11 +104,14 @@ fn match_events_by_summary() { } fn main() { - let calendars = read_icalendar_from_file("test.ics").unwrap(); + let mut args = std::env::args().skip(1); + let filename = args.next().unwrap(); + let pattern = args.next().unwrap(); + let calendars = read_icalendar_from_file(&filename).unwrap(); println!("Found {} calendard in file...", calendars.len()); for c in calendars { - for e in c.events { + for e in c.events.iter().filter(|e| match_event(&e, &pattern)) { print_event(&e); } } |