Files
pacdef_rust/src/ui.rs
T
2022-12-02 16:40:42 +01:00

12 lines
333 B
Rust

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