add ui module

This commit is contained in:
Dr. Matthias Ratajczak
2022-12-02 16:32:08 +01:00
parent 7cd415985d
commit be3e2af1ef
5 changed files with 27 additions and 13 deletions
+14
View File
@@ -0,0 +1,14 @@
use std::process::exit;
use std::io::Write::std::io;
use std;
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)
}
}