Reimplement imag-contact
This commit is contained in:
parent
a83d10fb1e
commit
d6f8751f6e
3 changed files with 108 additions and 167 deletions
|
@ -44,14 +44,13 @@ use toml_query::read::TomlValueReadExt;
|
||||||
use toml::Value;
|
use toml::Value;
|
||||||
use uuid::Uuid;
|
use uuid::Uuid;
|
||||||
|
|
||||||
|
use libimagcontact::store::ContactStore;
|
||||||
use libimagcontact::error::ContactError as CE;
|
use libimagcontact::error::ContactError as CE;
|
||||||
use libimagcontact::store::UniqueContactPathGenerator;
|
|
||||||
use libimagrt::runtime::Runtime;
|
use libimagrt::runtime::Runtime;
|
||||||
use libimagerror::str::ErrFromStr;
|
use libimagerror::str::ErrFromStr;
|
||||||
use libimagerror::trace::MapErrTrace;
|
use libimagerror::trace::MapErrTrace;
|
||||||
use libimagerror::trace::trace_error;
|
use libimagerror::trace::trace_error;
|
||||||
use libimagutil::warn_result::WarnResult;
|
use libimagutil::warn_result::WarnResult;
|
||||||
use libimagentryref::refstore::RefStore;
|
|
||||||
|
|
||||||
const TEMPLATE : &'static str = include_str!("../static/new-contact-template.toml");
|
const TEMPLATE : &'static str = include_str!("../static/new-contact-template.toml");
|
||||||
|
|
||||||
|
@ -158,7 +157,8 @@ pub fn create(rt: &Runtime) {
|
||||||
|
|
||||||
if let Some(location) = location {
|
if let Some(location) = location {
|
||||||
if !scmd.is_present("dont-track") {
|
if !scmd.is_present("dont-track") {
|
||||||
RefStore::create_ref::<UniqueContactPathGenerator, _>(rt.store(), location)
|
rt.store()
|
||||||
|
.create_from_path(&location)
|
||||||
.map_err_trace_exit_unwrap(1);
|
.map_err_trace_exit_unwrap(1);
|
||||||
|
|
||||||
info!("Created entry in store");
|
info!("Created entry in store");
|
||||||
|
|
|
@ -48,7 +48,6 @@ extern crate libimagstore;
|
||||||
extern crate libimagerror;
|
extern crate libimagerror;
|
||||||
extern crate libimagutil;
|
extern crate libimagutil;
|
||||||
extern crate libimaginteraction;
|
extern crate libimaginteraction;
|
||||||
extern crate libimagentryref;
|
|
||||||
extern crate libimagentryedit;
|
extern crate libimagentryedit;
|
||||||
|
|
||||||
use std::process::exit;
|
use std::process::exit;
|
||||||
|
@ -57,7 +56,6 @@ use std::io::Write;
|
||||||
|
|
||||||
use handlebars::Handlebars;
|
use handlebars::Handlebars;
|
||||||
use clap::ArgMatches;
|
use clap::ArgMatches;
|
||||||
use vobject::vcard::Vcard;
|
|
||||||
use toml_query::read::TomlValueReadTypeExt;
|
use toml_query::read::TomlValueReadTypeExt;
|
||||||
use walkdir::WalkDir;
|
use walkdir::WalkDir;
|
||||||
|
|
||||||
|
@ -67,14 +65,12 @@ use libimagerror::str::ErrFromStr;
|
||||||
use libimagerror::trace::MapErrTrace;
|
use libimagerror::trace::MapErrTrace;
|
||||||
use libimagerror::io::ToExitCode;
|
use libimagerror::io::ToExitCode;
|
||||||
use libimagerror::exit::ExitUnwrap;
|
use libimagerror::exit::ExitUnwrap;
|
||||||
|
use libimagerror::iter::TraceIterator;
|
||||||
use libimagcontact::store::ContactStore;
|
use libimagcontact::store::ContactStore;
|
||||||
use libimagcontact::store::UniqueContactPathGenerator;
|
|
||||||
use libimagcontact::error::ContactError as CE;
|
use libimagcontact::error::ContactError as CE;
|
||||||
use libimagcontact::contact::Contact;
|
use libimagcontact::contact::Contact;
|
||||||
use libimagcontact::deser::DeserVcard;
|
use libimagcontact::deser::DeserVcard;
|
||||||
use libimagstore::iter::get::StoreIdGetIteratorExtension;
|
use libimagstore::iter::get::StoreIdGetIteratorExtension;
|
||||||
use libimagentryref::reference::Ref;
|
|
||||||
use libimagentryref::refstore::RefStore;
|
|
||||||
|
|
||||||
mod ui;
|
mod ui;
|
||||||
mod util;
|
mod util;
|
||||||
|
@ -128,24 +124,13 @@ fn list(rt: &Runtime) {
|
||||||
.ok_or_else(|| CE::from("StoreId not found".to_owned()))
|
.ok_or_else(|| CE::from("StoreId not found".to_owned()))
|
||||||
.map_err_trace_exit_unwrap(1);
|
.map_err_trace_exit_unwrap(1);
|
||||||
|
|
||||||
fle
|
fle.deser().map_err_trace_exit_unwrap(1)
|
||||||
.get_contact_data()
|
|
||||||
.map(|cd| (fle, cd))
|
|
||||||
.map(|(fle, cd)| (fle, cd.into_inner()))
|
|
||||||
.map(|(fle, cd)| {
|
|
||||||
let card = Vcard::from_component(cd).unwrap_or_else(|e| {
|
|
||||||
error!("Element is not a VCARD object: {:?}", e);
|
|
||||||
exit(1)
|
|
||||||
});
|
|
||||||
(fle, card)
|
|
||||||
})
|
|
||||||
.map_err_trace_exit_unwrap(1)
|
|
||||||
})
|
})
|
||||||
.enumerate();
|
.enumerate();
|
||||||
|
|
||||||
if scmd.is_present("json") {
|
if scmd.is_present("json") {
|
||||||
let v : Vec<DeserVcard> = iterator
|
let v : Vec<DeserVcard> = iterator.map(|tpl| tpl.1).collect();
|
||||||
.map(|(_, (_, vcard))| DeserVcard::from(vcard)).collect();
|
|
||||||
match ::serde_json::to_string(&v) {
|
match ::serde_json::to_string(&v) {
|
||||||
Ok(s) => writeln!(rt.stdout(), "{}", s).to_exit_code().unwrap_or_exit(),
|
Ok(s) => writeln!(rt.stdout(), "{}", s).to_exit_code().unwrap_or_exit(),
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
|
@ -155,9 +140,8 @@ fn list(rt: &Runtime) {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
iterator
|
iterator
|
||||||
.map(|(i, (fle, vcard))| {
|
.map(|(i, deservcard)| {
|
||||||
let hash = String::from(fle.get_hash().map_err_trace_exit_unwrap(1));
|
let data = build_data_object_for_handlebars(i, &deservcard);
|
||||||
let data = build_data_object_for_handlebars(i, hash, &vcard);
|
|
||||||
|
|
||||||
list_format.render("format", &data)
|
list_format.render("format", &data)
|
||||||
.err_from_str()
|
.err_from_str()
|
||||||
|
@ -219,30 +203,45 @@ fn import(rt: &Runtime) {
|
||||||
fn show(rt: &Runtime) {
|
fn show(rt: &Runtime) {
|
||||||
let scmd = rt.cli().subcommand_matches("show").unwrap();
|
let scmd = rt.cli().subcommand_matches("show").unwrap();
|
||||||
let hash = scmd.value_of("hash").map(String::from).unwrap(); // safed by clap
|
let hash = scmd.value_of("hash").map(String::from).unwrap(); // safed by clap
|
||||||
|
|
||||||
let contact_data = rt.store()
|
|
||||||
.get_ref::<UniqueContactPathGenerator, _>(hash.clone())
|
|
||||||
.map_err_trace_exit_unwrap(1)
|
|
||||||
.ok_or(CE::from(format!("No entry for hash {}", hash)))
|
|
||||||
.map_err_trace_exit_unwrap(1)
|
|
||||||
.get_contact_data()
|
|
||||||
.map_err_trace_exit_unwrap(1)
|
|
||||||
.into_inner();
|
|
||||||
let vcard = Vcard::from_component(contact_data)
|
|
||||||
.unwrap_or_else(|e| {
|
|
||||||
error!("Element is not a VCARD object: {:?}", e);
|
|
||||||
exit(1)
|
|
||||||
});
|
|
||||||
|
|
||||||
let show_format = get_contact_print_format("contact.show_format", rt, &scmd);
|
let show_format = get_contact_print_format("contact.show_format", rt, &scmd);
|
||||||
let data = build_data_object_for_handlebars(0, hash, &vcard);
|
let out = rt.stdout();
|
||||||
|
let mut outlock = out.lock();
|
||||||
|
|
||||||
|
rt.store()
|
||||||
|
.all_contacts()
|
||||||
|
.map_err_trace_exit_unwrap(1)
|
||||||
|
.into_get_iter(rt.store())
|
||||||
|
.trace_unwrap_exit(1)
|
||||||
|
.map(|o| o.unwrap_or_else(|| {
|
||||||
|
error!("Failed to get entry");
|
||||||
|
exit(1)
|
||||||
|
}))
|
||||||
|
.filter_map(|entry| {
|
||||||
|
let deser = entry.deser().map_err_trace_exit_unwrap(1);
|
||||||
|
|
||||||
|
if deser.uid()
|
||||||
|
.ok_or_else(|| {
|
||||||
|
error!("Could not get StoreId from Store::all_contacts(). This is a BUG!");
|
||||||
|
::std::process::exit(1)
|
||||||
|
})
|
||||||
|
.unwrap() // exited above
|
||||||
|
.starts_with(&hash)
|
||||||
|
{
|
||||||
|
Some(deser)
|
||||||
|
} else {
|
||||||
|
None
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.for_each(|elem| {
|
||||||
|
let data = build_data_object_for_handlebars(0, &elem);
|
||||||
|
|
||||||
let s = show_format
|
let s = show_format
|
||||||
.render("format", &data)
|
.render("format", &data)
|
||||||
.err_from_str()
|
.err_from_str()
|
||||||
.map_err(CE::from)
|
.map_err(CE::from)
|
||||||
.map_err_trace_exit_unwrap(1);
|
.map_err_trace_exit_unwrap(1);
|
||||||
let _ = writeln!(::std::io::stdout(), "{}", s).to_exit_code().unwrap_or_exit();
|
let _ = writeln!(outlock, "{}", s).to_exit_code().unwrap_or_exit();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
fn find(rt: &Runtime) {
|
fn find(rt: &Runtime) {
|
||||||
|
@ -270,30 +269,20 @@ fn find(rt: &Runtime) {
|
||||||
})
|
})
|
||||||
.unwrap() // safed above
|
.unwrap() // safed above
|
||||||
})
|
})
|
||||||
.filter_map(|cont| {
|
.filter_map(|entry| {
|
||||||
let comp = cont
|
let card = entry.deser().map_err_trace_exit_unwrap(1);
|
||||||
.get_contact_data()
|
|
||||||
.map_err_trace_exit_unwrap(1)
|
|
||||||
.into_inner();
|
|
||||||
|
|
||||||
let card = Vcard::from_component(comp)
|
|
||||||
.map_err(|_| {
|
|
||||||
error!("Could not build Vcard from {:?}", cont.get_location());
|
|
||||||
::std::process::exit(1)
|
|
||||||
})
|
|
||||||
.unwrap(); // safed above
|
|
||||||
|
|
||||||
let str_contains_any = |s: &String, v: &Vec<String>| {
|
let str_contains_any = |s: &String, v: &Vec<String>| {
|
||||||
v.iter().any(|i| s.contains(i))
|
v.iter().any(|i| s.contains(i))
|
||||||
};
|
};
|
||||||
|
|
||||||
let take = card.adr().iter().any(|a| str_contains_any(a.raw(), &grepstring))
|
let take = card.adr().iter().any(|a| str_contains_any(a, &grepstring))
|
||||||
|| card.email().iter().any(|a| str_contains_any(a.raw(), &grepstring))
|
|| card.email().iter().any(|a| str_contains_any(a, &grepstring))
|
||||||
|| card.fullname().iter().any(|a| str_contains_any(a.raw(), &grepstring));
|
|| card.fullname().iter().any(|a| str_contains_any(a, &grepstring));
|
||||||
|
|
||||||
if take {
|
if take {
|
||||||
// optimization so we don't have to parse again in the next step
|
// optimization so we don't have to parse again in the next step
|
||||||
Some((cont, card))
|
Some((entry, card))
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
|
@ -301,8 +290,8 @@ fn find(rt: &Runtime) {
|
||||||
.enumerate();
|
.enumerate();
|
||||||
|
|
||||||
if scmd.is_present("json") {
|
if scmd.is_present("json") {
|
||||||
let v : Vec<DeserVcard> = iterator
|
let v : Vec<DeserVcard> = iterator.map(|(_, tlp)| tlp.1).collect();
|
||||||
.map(|(_, (_, vcard))| DeserVcard::from(vcard)).collect();
|
|
||||||
match ::serde_json::to_string(&v) {
|
match ::serde_json::to_string(&v) {
|
||||||
Ok(s) => writeln!(rt.stdout(), "{}", s).to_exit_code().unwrap_or_exit(),
|
Ok(s) => writeln!(rt.stdout(), "{}", s).to_exit_code().unwrap_or_exit(),
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
|
@ -312,22 +301,22 @@ fn find(rt: &Runtime) {
|
||||||
}
|
}
|
||||||
} else if scmd.is_present("find-id") {
|
} else if scmd.is_present("find-id") {
|
||||||
iterator
|
iterator
|
||||||
.for_each(|(_i, (fle, _card))| {
|
.for_each(|(_i, (entry, _))| {
|
||||||
writeln!(rt.stdout(), "{}", fle.get_location())
|
writeln!(rt.stdout(), "{}", entry.get_location())
|
||||||
.to_exit_code()
|
.to_exit_code()
|
||||||
.unwrap_or_exit();
|
.unwrap_or_exit();
|
||||||
})
|
})
|
||||||
} else if scmd.is_present("find-full-id") {
|
} else if scmd.is_present("find-full-id") {
|
||||||
let storepath = rt.store().path().display();
|
let storepath = rt.store().path().display();
|
||||||
iterator
|
iterator
|
||||||
.for_each(|(_i, (fle, _card))| {
|
.for_each(|(_i, (entry, _))| {
|
||||||
writeln!(rt.stdout(), "{}/{}", storepath, fle.get_location())
|
writeln!(rt.stdout(), "{}/{}", storepath, entry.get_location())
|
||||||
.to_exit_code()
|
.to_exit_code()
|
||||||
.unwrap_or_exit();
|
.unwrap_or_exit();
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
iterator
|
iterator
|
||||||
.for_each(|(i, (fle, card))| {
|
.for_each(|(i, (_, card))| {
|
||||||
let fmt = if scmd.is_present("find-show") {
|
let fmt = if scmd.is_present("find-show") {
|
||||||
&show_format
|
&show_format
|
||||||
} else if scmd.is_present("find-list") {
|
} else if scmd.is_present("find-list") {
|
||||||
|
@ -336,8 +325,7 @@ fn find(rt: &Runtime) {
|
||||||
&list_format
|
&list_format
|
||||||
};
|
};
|
||||||
|
|
||||||
let hash = fle.get_hash().map(String::from).map_err_trace_exit_unwrap(1);
|
let data = build_data_object_for_handlebars(i, &card);
|
||||||
let data = build_data_object_for_handlebars(i, hash, &card);
|
|
||||||
let s = fmt
|
let s = fmt
|
||||||
.render("format", &data)
|
.render("format", &data)
|
||||||
.err_from_str()
|
.err_from_str()
|
||||||
|
|
|
@ -18,105 +18,58 @@
|
||||||
//
|
//
|
||||||
|
|
||||||
use std::collections::BTreeMap;
|
use std::collections::BTreeMap;
|
||||||
use vobject::vcard::Vcard;
|
|
||||||
|
|
||||||
pub fn build_data_object_for_handlebars<'a>(i: usize, hash: String, vcard: &Vcard) -> BTreeMap<&'static str, String> {
|
use libimagcontact::deser::DeserVcard;
|
||||||
|
|
||||||
|
pub fn build_data_object_for_handlebars<'a>(i: usize, vcard: &DeserVcard) -> BTreeMap<&'static str, String> {
|
||||||
let mut data = BTreeMap::new();
|
let mut data = BTreeMap::new();
|
||||||
|
|
||||||
|
let process_list = |list: &Vec<String>| {
|
||||||
|
list.iter()
|
||||||
|
.map(String::clone)
|
||||||
|
.collect::<Vec<_>>()
|
||||||
|
.join(", ")
|
||||||
|
};
|
||||||
|
|
||||||
|
let process_opt = |opt: Option<&String>| {
|
||||||
|
opt.map(String::clone).unwrap_or_else(String::new)
|
||||||
|
};
|
||||||
|
|
||||||
{
|
{
|
||||||
data.insert("i" , format!("{}", i));
|
data.insert("i" , format!("{}", i));
|
||||||
|
|
||||||
// The hash (as in libimagentryref) of the contact
|
// The hash (as in libimagentryref) of the contact
|
||||||
data.insert("id" , hash);
|
data.insert("id" , process_opt(vcard.uid()));
|
||||||
|
data.insert("ADR" , process_list(vcard.adr()));
|
||||||
data.insert("ADR" , vcard.adr()
|
data.insert("ANNIVERSARY" , process_opt(vcard.anniversary()));
|
||||||
.into_iter().map(|c| c.raw().clone()).collect::<Vec<_>>().join(", "));
|
data.insert("BDAY" , process_opt(vcard.bday()));
|
||||||
|
data.insert("CATEGORIES" , process_list(vcard.categories()));
|
||||||
data.insert("ANNIVERSARY" , vcard.anniversary()
|
data.insert("CLIENTPIDMAP" , process_opt(vcard.clientpidmap()));
|
||||||
.map(|c| c.raw().clone()).unwrap_or(String::new()));
|
data.insert("EMAIL" , process_list(vcard.email()));
|
||||||
|
data.insert("FN" , process_list(vcard.fullname()));
|
||||||
data.insert("BDAY" , vcard.bday()
|
data.insert("GENDER" , process_opt(vcard.gender()));
|
||||||
.map(|c| c.raw().clone()).unwrap_or(String::new()));
|
data.insert("GEO" , process_list(vcard.geo()));
|
||||||
|
data.insert("IMPP" , process_list(vcard.impp()));
|
||||||
data.insert("CATEGORIES" , vcard.categories()
|
data.insert("KEY" , process_list(vcard.key()));
|
||||||
.into_iter().map(|c| c.raw().clone()).collect::<Vec<_>>().join(", "));
|
data.insert("LANG" , process_list(vcard.lang()));
|
||||||
|
data.insert("LOGO" , process_list(vcard.logo()));
|
||||||
data.insert("CLIENTPIDMAP" , vcard.clientpidmap()
|
data.insert("MEMBER" , process_list(vcard.member()));
|
||||||
.map(|c| c.raw().clone()).unwrap_or(String::new()));
|
data.insert("N" , process_opt(vcard.name()));
|
||||||
|
data.insert("NICKNAME" , process_list(vcard.nickname()));
|
||||||
data.insert("EMAIL" , vcard.email()
|
data.insert("NOTE" , process_list(vcard.note()));
|
||||||
.into_iter().map(|c| c.raw().clone()).collect::<Vec<_>>().join(", "));
|
data.insert("ORG" , process_list(vcard.org()));
|
||||||
|
data.insert("PHOTO" , process_list(vcard.photo()));
|
||||||
data.insert("FN" , vcard.fullname()
|
data.insert("PRIOD" , process_opt(vcard.proid()));
|
||||||
.into_iter().map(|c| c.raw().clone()).collect::<Vec<_>>().join(", "));
|
data.insert("RELATED" , process_list(vcard.related()));
|
||||||
|
data.insert("REV" , process_opt(vcard.rev()));
|
||||||
data.insert("GENDER" , vcard.gender()
|
data.insert("ROLE" , process_list(vcard.role()));
|
||||||
.map(|c| c.raw().clone()).unwrap_or(String::new()));
|
data.insert("SOUND" , process_list(vcard.sound()));
|
||||||
|
data.insert("TEL" , process_list(vcard.tel()));
|
||||||
data.insert("GEO" , vcard.geo()
|
data.insert("TITLE" , process_list(vcard.title()));
|
||||||
.into_iter().map(|c| c.raw().clone()).collect::<Vec<_>>().join(", "));
|
data.insert("TZ" , process_list(vcard.tz()));
|
||||||
|
data.insert("UID" , process_opt(vcard.uid()));
|
||||||
data.insert("IMPP" , vcard.impp()
|
data.insert("URL" , process_list(vcard.url()));
|
||||||
.into_iter().map(|c| c.raw().clone()).collect::<Vec<_>>().join(", "));
|
data.insert("VERSION" , process_opt(vcard.version()));
|
||||||
|
|
||||||
data.insert("KEY" , vcard.key()
|
|
||||||
.into_iter().map(|c| c.raw().clone()).collect::<Vec<_>>().join(", "));
|
|
||||||
|
|
||||||
data.insert("LANG" , vcard.lang()
|
|
||||||
.into_iter().map(|c| c.raw().clone()).collect::<Vec<_>>().join(", "));
|
|
||||||
|
|
||||||
data.insert("LOGO" , vcard.logo()
|
|
||||||
.into_iter().map(|c| c.raw().clone()).collect::<Vec<_>>().join(", "));
|
|
||||||
|
|
||||||
data.insert("MEMBER" , vcard.member()
|
|
||||||
.into_iter().map(|c| c.raw().clone()).collect::<Vec<_>>().join(", "));
|
|
||||||
|
|
||||||
data.insert("N" , vcard.name()
|
|
||||||
.map(|c| c.raw().clone()).unwrap_or(String::new()));
|
|
||||||
|
|
||||||
data.insert("NICKNAME" , vcard.nickname()
|
|
||||||
.into_iter().map(|c| c.raw().clone()).collect::<Vec<_>>().join(", "));
|
|
||||||
|
|
||||||
data.insert("NOTE" , vcard.note()
|
|
||||||
.into_iter().map(|c| c.raw().clone()).collect::<Vec<_>>().join(", "));
|
|
||||||
|
|
||||||
data.insert("ORG" , vcard.org()
|
|
||||||
.into_iter().map(|c| c.raw().clone()).collect::<Vec<_>>().join(", "));
|
|
||||||
|
|
||||||
data.insert("PHOTO" , vcard.photo()
|
|
||||||
.into_iter().map(|c| c.raw().clone()).collect::<Vec<_>>().join(", "));
|
|
||||||
|
|
||||||
data.insert("PRIOD" , vcard.proid()
|
|
||||||
.map(|c| c.raw().clone()).unwrap_or(String::new()));
|
|
||||||
|
|
||||||
data.insert("RELATED" , vcard.related()
|
|
||||||
.into_iter().map(|c| c.raw().clone()).collect::<Vec<_>>().join(", "));
|
|
||||||
|
|
||||||
data.insert("REV" , vcard.rev()
|
|
||||||
.map(|c| c.raw().clone()).unwrap_or(String::new()));
|
|
||||||
|
|
||||||
data.insert("ROLE" , vcard.role()
|
|
||||||
.into_iter().map(|c| c.raw().clone()).collect::<Vec<_>>().join(", "));
|
|
||||||
|
|
||||||
data.insert("SOUND" , vcard.sound()
|
|
||||||
.into_iter().map(|c| c.raw().clone()).collect::<Vec<_>>().join(", "));
|
|
||||||
|
|
||||||
data.insert("TEL" , vcard.tel()
|
|
||||||
.into_iter().map(|c| c.raw().clone()).collect::<Vec<_>>().join(", "));
|
|
||||||
|
|
||||||
data.insert("TITLE" , vcard.title()
|
|
||||||
.into_iter().map(|c| c.raw().clone()).collect::<Vec<_>>().join(", "));
|
|
||||||
|
|
||||||
data.insert("TZ" , vcard.tz()
|
|
||||||
.into_iter().map(|c| c.raw().clone()).collect::<Vec<_>>().join(", "));
|
|
||||||
|
|
||||||
data.insert("UID" , vcard.uid()
|
|
||||||
.map(|c| c.raw().clone()).unwrap_or(String::new()));
|
|
||||||
|
|
||||||
data.insert("URL" , vcard.url()
|
|
||||||
.into_iter().map(|c| c.raw().clone()).collect::<Vec<_>>().join(", "));
|
|
||||||
|
|
||||||
data.insert("VERSION" , vcard.version()
|
|
||||||
.map(|c| c.raw().clone()).unwrap_or(String::new()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
data
|
data
|
||||||
|
|
Loading…
Reference in a new issue