mirror of
https://github.com/jht5945/rust_util.git
synced 2025-12-27 07:30:05 +08:00
feat: fix util_term
This commit is contained in:
@@ -1,16 +1,17 @@
|
|||||||
use std::io::{self, Write};
|
use std::io::{self, Write};
|
||||||
use crate::print_ex;
|
|
||||||
|
|
||||||
pub const RED: &str = "\x1B[91m";
|
use crate::util_msg;
|
||||||
pub const GREEN: &str = "\x1B[92m";
|
|
||||||
|
pub const RED: &str = "\x1B[91m";
|
||||||
|
pub const GREEN: &str = "\x1B[92m";
|
||||||
pub const YELLOW: &str = "\x1B[93m";
|
pub const YELLOW: &str = "\x1B[93m";
|
||||||
pub const BOLD: &str = "\x1B[1m";
|
pub const BOLD: &str = "\x1B[1m";
|
||||||
pub const UNDER: &str = "\x1B[4m";
|
pub const UNDER: &str = "\x1B[4m";
|
||||||
pub const END: &str = "\x1B[0m";
|
pub const END: &str = "\x1B[0m";
|
||||||
|
|
||||||
pub fn read_yes_no(hint: &str) -> bool {
|
pub fn read_yes_no(hint: &str) -> bool {
|
||||||
loop {
|
loop {
|
||||||
print_ex!("{} (Yes/No): ", hint);
|
util_msg::print_ex(&format!("{} (Yes/No): ", hint), false);
|
||||||
io::stdout().flush().ok();
|
io::stdout().flush().ok();
|
||||||
let mut buff = String::new();
|
let mut buff = String::new();
|
||||||
let _ = io::stdin().read_line(&mut buff).expect("Read line from stdin");
|
let _ = io::stdin().read_line(&mut buff).expect("Read line from stdin");
|
||||||
|
|||||||
Reference in New Issue
Block a user