= Vec::new();
+
+ loop {
+ let street_addr = query_input("Street address (required)", false)?;
+ let extended_addr =
+ query_input("Extended address (e.g. apartment number, optional)", true)?;
+ let city = query_input("Municipality (required)", false)?;
+ let state = query_input("State/province (required)", false)?;
+ let zip = query_input("ZIP/postal code (required)", false)?;
+ let country = query_input("Country (optional)", true)?;
+ let addr_type = query_input("Address type (e.g. home, optional)", true)?;
+
+ let street_addr = format!("{street_addr},{extended_addr}");
+
+ let property = match addr_type.is_empty() {
+ false => format!("{ADDRESS};TYPE={addr_type}"),
+ true => ADDRESS.to_string(),
+ };
+
+ addresses.push(format!(
+ "{property}:;;{street_addr};{city};{state};{zip};{country}"
+ ));
+
+ if query_bool("Do you want to add another address?", false)? {
+ continue;
+ }
+
+ break;
+ }
+
+ Ok(addresses)
+}
diff --git a/__external/vcard-qr/src/vcard.rs b/__external/vcard-qr/src/vcard.rs
new file mode 100644
index 0000000..0c11773
--- /dev/null
+++ b/__external/vcard-qr/src/vcard.rs
@@ -0,0 +1,45 @@
+const VCARD_HEADER: &str = "BEGIN:VCARD\nVERSION:4.0\n";
+const VCARD_FOOTER: &str = "END:VCARD";
+
+pub struct VCard {
+ buf: String,
+}
+
+impl VCard {
+ pub fn new() -> Self {
+ VCard {
+ buf: VCARD_HEADER.into(),
+ }
+ }
+
+ pub fn push(&mut self, property: P, value: V)
+ where
+ P: AsRef,
+ V: AsRef,
+ {
+ self.buf
+ .push_str(&format!("{}:{}\n", property.as_ref(), value.as_ref()))
+ }
+
+ pub fn optional_push(&mut self, property: P, value: V)
+ where
+ P: AsRef,
+ V: AsRef,
+ {
+ if !value.as_ref().is_empty() {
+ self.push(property, value)
+ }
+ }
+
+ pub fn push_explicit(&mut self, data: T)
+ where
+ T: AsRef,
+ {
+ self.buf.push_str(&format!("{}\n", data.as_ref()))
+ }
+
+ pub fn finalize(mut self) -> String {
+ self.push_explicit(VCARD_FOOTER);
+ self.buf.trim().to_owned()
+ }
+}
diff --git a/__external/vcard-qr/vcard.png b/__external/vcard-qr/vcard.png
new file mode 100644
index 0000000..fbb025d
Binary files /dev/null and b/__external/vcard-qr/vcard.png differ