1mod macros {
2 #![allow(unused_macros)]
3 #![allow(unused_imports)]
4 #![allow(dead_code)]
5
6 #[macro_export]
7 macro_rules! input {
16 ($($arg:tt)*) => {
17 {
18 input(&format!($($arg)*))
19 }
20 };
21 }
22
23 #[macro_export]
24 macro_rules! input_hidden {
33 ($($arg:tt)*) => {
34 {
35 input_hidden(&format!($($arg)*))
36 }
37 };
38 }
39
40 pub use input;
41 pub use input_hidden;
42}
43
44mod functions {
45 use std::io::Write;
46 use rpassword;
47
48 pub fn input(prefix: &str) -> String {
49 let mut prompt = String::new();
50
51 print!("{}", prefix);
52
53 std::io::stdout().flush().unwrap();
54 std::io::stdin().read_line(&mut prompt).unwrap();
55
56 return prompt.trim().to_string();
57 }
58
59 pub fn input_hidden(prefix: &str) -> String {
60 let prompt = rpassword::prompt_password(prefix).unwrap();
61
62 return prompt.trim().to_string();
63 }
64}
65
66pub mod prelude {
67 pub use super::macros::*;
68 pub use super::functions::*;
69}