feat(cli): don't validate email addresses in init command

Co-authored-by: Amaan Qureshi <amaanq12@gmail.com>
This commit is contained in:
kylegoetz 2024-12-12 19:00:48 -06:00 committed by GitHub
parent 530e0571c9
commit cd94dbd57f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -596,19 +596,8 @@ impl Init {
};
let email = || {
Input::with_theme(&ColorfulTheme::default())
Input::<String>::with_theme(&ColorfulTheme::default())
.with_prompt("Author email")
.validate_with({
move |input: &String| -> Result<(), &str> {
if (input.contains('@') && input.contains('.'))
|| input.trim().is_empty()
{
Ok(())
} else {
Err("This is not a valid email address")
}
}
})
.allow_empty(true)
.interact_text()
.map(|e| (!e.trim().is_empty()).then_some(e))