made expression solutions bold
This commit is contained in:
parent
e195668eb8
commit
e66cd08374
1 changed files with 3 additions and 19 deletions
22
src/main.rs
22
src/main.rs
|
@ -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),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue