made expression solutions bold

This commit is contained in:
Valerie Wolfe 2022-06-08 15:24:06 -04:00
parent e195668eb8
commit e66cd08374

View file

@ -36,27 +36,11 @@ fn do_eval(i_expression: String, context: &mut HashMapContext) -> (String, Optio
let expression = i_expression.as_str(); let expression = i_expression.as_str();
let i_result = eval_with_context_mut(expression, context); let i_result = eval_with_context_mut(expression, context);
if i_result.is_err() { if i_result.is_err() {
return ( return (format!("{}🞪 {}{}", color::Fg(color::Red), style::Bold, expression), None);
format!("{}🞪 {}{}", color::Fg(color::Red), style::Bold, expression),
None,
);
} }
let result = i_result.ok().unwrap(); let result = i_result.ok().unwrap();
if result.is_empty() { if result.is_empty() {
return ( return (format!("{}{}{}", color::Fg(color::Green), style::Bold, expression), None);
format!("{}{}{}", color::Fg(color::Green), style::Bold, expression),
None,
);
} }
return ( return (format!("{}{}{}{} = {}{}", style::Faint, style::Italic, expression, style::Reset, style::Bold, result), Some(result));
format!(
"{}{}{}{} = {}",
style::Faint,
style::Italic,
expression,
style::Reset,
result
),
Some(result),
);
} }