aboutsummaryrefslogtreecommitdiff
path: root/src/main.rs
blob: 67eb0fcc19bf3e8d69636ffdc46d95c7eda9bee0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
extern crate ical;
extern crate chrono;
extern crate chrono_tz;

mod date;
mod event;
mod periodic;
mod calendar;
mod errors;

use std::env;
use std::io::BufReader;
use std::fs::File;
use chrono::Duration;
use date::Date;
use calendar::Calendar;

fn main() {
    let args: Vec<_> = env::args().collect();
    let file = File::open(&args[1]).unwrap();
    let buf = BufReader::new(file);
    let calendar = Calendar::parse(buf).unwrap();
    println!("{}", calendar);
    println!("");

    let now = Date::now();
    let events = calendar.get(&now, &(now + Duration::weeks(10)));
    for e in events {
        println!("{}", e);
    }
}