start reimplementing main functions again

This commit is contained in:
steven-omaha
2023-01-09 18:30:12 +01:00
parent ce98fa1cea
commit 4907787911
6 changed files with 107 additions and 46 deletions
+2 -5
View File
@@ -1,11 +1,8 @@
use std::io::{BufRead, Write};
use std::process::exit;
pub(crate) fn get_user_confirmation() {
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();
if !(reply.is_empty() || reply.to_lowercase().contains('y')) {
exit(0)
}
!(reply.is_empty() || reply.to_lowercase().contains('y'))
}