use std::io;
use std::io::Write;
pub mod shell;
static mut HOME: String = String::new();
pub fn init() {
let homedir = home::home_dir()
.unwrap()
.into_os_string()
.into_string()
.unwrap();
unsafe {
HOME = String::from(homedir + "/.rustmetos");
}
}
pub fn home() -> &'static str {
unsafe { &HOME }
}
pub fn input(prompt: &str) -> String {
print!("{}", prompt); io::stdout()
.flush()
.expect("Unable to flush the stdout stream");
let mut buffer = String::new();
io::stdin()
.read_line(&mut buffer)
.expect("Unable to read into the buffer");
trim_newline(&mut buffer);
buffer }
fn trim_newline(s: &mut String) {
if s.ends_with('\n') {
s.pop();
if s.ends_with('\r') {
s.pop();
}
}
}