diff --git a/src/utils.rs b/src/utils.rs index 9bc9474..43d27f9 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -6,6 +6,7 @@ use std::sync::{Arc, Mutex}; use minidom::Element; use crate::traits::CompleteCalendar; +use crate::traits::DavCalendar; use crate::calendar::CalendarId; use crate::Item; use crate::item::SyncStatus; @@ -77,6 +78,24 @@ where } } +/// A debug utility that pretty-prints calendars +pub async fn print_dav_calendar_list(cals: &HashMap>>) +where + C: DavCalendar, +{ + for (id, cal) in cals { + println!("CAL {}", id); + match cal.lock().unwrap().get_item_version_tags().await { + Err(_err) => continue, + Ok(map) => { + for (id, version_tag) in map { + println!(" * {} (version {:?})", id, version_tag); + } + }, + } + } +} + pub fn print_task(item: &Item) { match item { Item::Task(task) => {