1use std::io::{self, Write};
2
3use chrono::Local;
4
5pub fn get_formatted_time() -> String {
6 let now = Local::now();
7 let formatted_time = now.format("%d-%m-%Y %H:%M:%S");
8 formatted_time.to_string()
9}
10
11pub fn print(msg: &str) {
12 print!("\r{}", msg);
13 io::stdout().flush().unwrap();
14}
15
16pub fn println(msg: &str) {
17 print(format!("{}\n", msg).as_str());
18}
19
20pub fn input(msg: &str) -> String {
21 let mut input = String::new();
22 print(msg);
23 io::stdin()
24 .read_line(&mut input)
25 .expect("failed to read input");
26
27 println!("");
28 input.trim().to_string()
29}
30
31pub fn backspace() {
32 let back = 8u8 as char;
33 print!("{} {}", back, back);
34 io::stdout().flush().unwrap();
35}