Files
pacdef_rust/src/ui.rs
T
2023-01-10 14:48:18 +01:00

10 lines
306 B
Rust

use std::io::{BufRead, Write};
#[must_use]
pub(crate) fn get_user_confirmation() -> bool {
print!("Continue? [Y/n] ");
std::io::stdout().flush().unwrap();
let reply = std::io::stdin().lock().lines().next().unwrap().unwrap();
reply.trim().is_empty() || reply.to_lowercase().contains('y')
}