Cache saves to a folder
This commit is contained in:
parent
d6ee642dd9
commit
d53ec193d8
5 changed files with 106 additions and 134 deletions
15
src/utils.rs
15
src/utils.rs
|
@ -7,6 +7,7 @@ use minidom::Element;
|
|||
|
||||
use crate::traits::CompleteCalendar;
|
||||
use crate::calendar::CalendarId;
|
||||
use crate::Item;
|
||||
|
||||
/// Walks an XML tree and returns every element that has the given name
|
||||
pub fn find_elems<S: AsRef<str>>(root: &Element, searched_name: S) -> Vec<&Element> {
|
||||
|
@ -64,9 +65,17 @@ where
|
|||
for (id, cal) in cals {
|
||||
println!("CAL {}", id);
|
||||
for (_, item) in cal.lock().unwrap().get_items() {
|
||||
let task = item.unwrap_task();
|
||||
let completion = if task.completed() {"✓"} else {" "};
|
||||
println!(" {} {}\t{}", completion, task.name(), task.id());
|
||||
print_task(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn print_task(item: &Item) {
|
||||
match item {
|
||||
Item::Task(task) => {
|
||||
let completion = if task.completed() {"✓"} else {" "};
|
||||
println!(" {} {}\t{}", completion, task.name(), task.id());
|
||||
},
|
||||
_ => return,
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue