Better distinction ID/UID

This commit is contained in:
daladim 2021-11-15 23:52:26 +01:00
parent 56b86adf02
commit 2f7c14d0aa
13 changed files with 165 additions and 221 deletions

View file

@ -6,6 +6,7 @@ use std::hash::Hash;
use std::io::{stdin, stdout, Read, Write};
use minidom::Element;
use url::Url;
use crate::traits::CompleteCalendar;
use crate::traits::DavCalendar;
@ -107,7 +108,7 @@ pub fn print_task(item: &Item) {
SyncStatus::LocallyModified(_) => "~",
SyncStatus::LocallyDeleted(_) => "x",
};
println!(" {}{} {}\t{}", completion, sync, task.name(), task.id());
println!(" {}{} {}\t{}", completion, sync, task.name(), task.url());
},
_ => return,
}
@ -148,3 +149,10 @@ pub fn pause() {
stdout.flush().unwrap();
stdin().read_exact(&mut [0]).unwrap();
}
/// Generate a random URL with a given prefix
pub fn random_url(parent_calendar: &Url) -> Url {
let random = uuid::Uuid::new_v4().to_hyphenated().to_string();
parent_calendar.join(&random).unwrap(/* this cannot panic since we've just created a string that is a valid URL */)
}