Make sure we skip empty prompted emails

This commit is contained in:
Clément Renault 2025-06-05 10:59:06 +02:00
parent 4d819ea636
commit c7cb72a77a
No known key found for this signature in database
GPG Key ID: F250A4C4E3AE5F5F

View File

@ -155,16 +155,21 @@ async fn prompt_for_contact_email() -> anyhow::Result<Option<String>> {
return Ok(None); return Ok(None);
} }
println!("Would you mind providing your contact email for support and news?"); println!("Would you mind providing your contact email for support and news? We will use it to contact you with news only.");
println!("We will use it to contact you with news only."); println!("Press enter to skip.");
print!("contact email> "); print!("contact email> ");
std::io::stdout().flush()?; std::io::stdout().flush()?;
let mut email = String::new(); let mut email = String::new();
let mut stdin = BufReader::new(stdin); let mut stdin = BufReader::new(stdin);
let _ = stdin.read_line(&mut email).await?; let _ = stdin.read_line(&mut email).await?;
let email = email.trim();
Ok(Some(email.trim().to_string())) if email.is_empty() {
Ok(None)
} else {
Ok(Some(email.to_string()))
}
} }
async fn run_http( async fn run_http(