diff options
author | Ivan Tham <[email protected]> | 2020-11-01 17:28:05 +0000 |
---|---|---|
committer | Ivan Tham <[email protected]> | 2020-11-01 17:28:05 +0000 |
commit | ea95516537b9ef2c9badd01abcf72f20066f9c55 (patch) | |
tree | 3c58c044b38618a808d53ca81654c0a36b32b7e5 /src/main.rs | |
parent | d31097959f29d7b82dabfd050eb988a896c2e44b (diff) |
Add help command
Close #41
Diffstat (limited to 'src/main.rs')
-rw-r--r-- | src/main.rs | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/main.rs b/src/main.rs index bc22ce2..7086d15 100644 --- a/src/main.rs +++ b/src/main.rs | |||
@@ -193,7 +193,9 @@ fn parse_arguments() -> Configuration { | |||
193 | 193 | ||
194 | pub fn eval_math_expression(input: &str, prev_ans: Option<f64>) -> Result<f64, CalcError> { | 194 | pub fn eval_math_expression(input: &str, prev_ans: Option<f64>) -> Result<f64, CalcError> { |
195 | let input = input.trim(); | 195 | let input = input.trim(); |
196 | let input = input.replace(" ", ""); | 196 | if input == "help" { |
197 | return Err(CalcError::Help); | ||
198 | } | ||
197 | if input.is_empty() { | 199 | if input.is_empty() { |
198 | return Ok(0.); | 200 | return Ok(0.); |
199 | } | 201 | } |