utils can print remote calendars

This commit is contained in:
daladim 2021-03-28 20:02:35 +02:00
parent 45b4c1a056
commit e622ec0f7e

View file

@ -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<C>(cals: &HashMap<CalendarId, Arc<Mutex<C>>>)
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) => {