1
0
mirror of https://github.com/jht5945/rust_util.git synced 2025-12-27 15:40:03 +08:00

feat: fix util_term

This commit is contained in:
2023-10-25 01:13:36 +08:00
parent 29519b3a43
commit 16e859c785
2 changed files with 3 additions and 2 deletions

View File

@@ -1,6 +1,6 @@
[package] [package]
name = "rust_util" name = "rust_util"
version = "0.6.44" version = "0.6.45"
authors = ["Hatter Jiang <jht5945@gmail.com>"] authors = ["Hatter Jiang <jht5945@gmail.com>"]
edition = "2018" edition = "2018"
description = "Hatter's Rust Util" description = "Hatter's Rust Util"

View File

@@ -1,4 +1,5 @@
use std::io::{self, Write}; use std::io::{self, Write};
use crate::print_ex;
pub const RED: &str = "\x1B[91m"; pub const RED: &str = "\x1B[91m";
pub const GREEN: &str = "\x1B[92m"; pub const GREEN: &str = "\x1B[92m";
@@ -9,7 +10,7 @@ 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!("{} (Yes/No): ", hint); print_ex!("{} (Yes/No): ", hint);
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");