diff --git a/src/main.rs b/src/main.rs index 262a09c..cc12767 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,6 +1,11 @@ use std::{ env, - io::stdin + io::{ + stdin, + stdout, + + Write + } }; use evalexpr::{ @@ -20,6 +25,8 @@ fn main() { if expressions.len() == 0 { println!("{}quickmaths v0.1.2{}\n{}Interactive Mode{}", style::Bold, style::Reset, style::Faint, style::Reset); loop { + print!("> "); + stdout().flush().unwrap(); let mut i_line = String::new(); let line_result = stdin().read_line(&mut i_line); if line_result.is_err() { @@ -44,7 +51,7 @@ fn do_eval(i_expression: String, context: &mut HashMapContext) -> (String, Optio let expression = i_expression.as_str(); let i_result = eval_with_context_mut(expression, context); if i_result.is_err() { - return (format!("{}🞪 {}{}", color::Fg(color::Red), style::Bold, expression), None); + return (format!("{}✕ {}{}", color::Fg(color::Red), style::Bold, expression), None); } let result = i_result.ok().unwrap(); if result.is_empty() { @@ -53,7 +60,7 @@ fn do_eval(i_expression: String, context: &mut HashMapContext) -> (String, Optio let delimiter; match result { Value::Boolean(_bool) => delimiter = "is", - Value::String(ref _str) => delimiter = "=>", + Value::String(ref _str) => delimiter = "=>", _ => delimiter = "=" } return (format!("{}{}{}{} {} {}{}", style::Faint, style::Italic, expression, style::Reset, delimiter, style::Bold, result), Some(result));