blob: 0baef7dfb8d3c27d8b6142e6f2a6a8cd36868e98 (
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
32
33
34
35
36
|
use icalwrap::{IcalComponent,IcalProperty};
use utils::fileutil;
pub fn prettyprint(lines: &mut Iterator<Item = String>) {
let cals = fileutil::read_calendars_from_files(lines).unwrap();
for cal in cals {
let event = cal.get_principal_event();
prettyprint_comp(&event, cal.get_path_as_string());
}
}
pub fn prettyprint_comp(cal: &IcalComponent, path: Option<String>) {
let properties = cal.get_properties_all();
if let Some(path) = path {
debug!("path: {}", path);
}
debug!("property count: {}", properties.len());
for property in properties {
prettyprint_prop(&property);
}
println!();
}
fn prettyprint_prop(property: &IcalProperty) {
let name = property.get_name();
let value = property.get_value();
match name.as_str() {
"DTSTART" => {
let date = property.get_value_as_date();
println!("start: {}", date.unwrap());
},
"DESCRIPTION" => println!("description: {}", value),
_ => println!("{} - {}", name, value),
}
}
|