diff options
Diffstat (limited to 'src/main.rs')
-rw-r--r-- | src/main.rs | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/main.rs b/src/main.rs index bc22ce2..75c33bb 100644 --- a/src/main.rs +++ b/src/main.rs | |||
@@ -22,7 +22,7 @@ use crate::parse::*; | |||
22 | use crate::readline::*; | 22 | use crate::readline::*; |
23 | 23 | ||
24 | // extern crates | 24 | // extern crates |
25 | use clap::{App, Arg}; | 25 | use clap::{App, AppSettings, Arg}; |
26 | use directories::{ProjectDirs, UserDirs}; | 26 | use directories::{ProjectDirs, UserDirs}; |
27 | use lazy_static::lazy_static; | 27 | use lazy_static::lazy_static; |
28 | use rustyline::error::ReadlineError; | 28 | use rustyline::error::ReadlineError; |
@@ -150,6 +150,7 @@ fn parse_arguments() -> Configuration { | |||
150 | .version(env!("CARGO_PKG_VERSION")) | 150 | .version(env!("CARGO_PKG_VERSION")) |
151 | .author(env!("CARGO_PKG_AUTHORS")) | 151 | .author(env!("CARGO_PKG_AUTHORS")) |
152 | .about(env!("CARGO_PKG_DESCRIPTION")) | 152 | .about(env!("CARGO_PKG_DESCRIPTION")) |
153 | .global_setting(AppSettings::ColoredHelp) | ||
153 | .arg( | 154 | .arg( |
154 | Arg::with_name("fix") | 155 | Arg::with_name("fix") |
155 | .short("f") | 156 | .short("f") |
@@ -192,8 +193,10 @@ fn parse_arguments() -> Configuration { | |||
192 | } | 193 | } |
193 | 194 | ||
194 | pub fn eval_math_expression(input: &str, prev_ans: Option<f64>) -> Result<f64, CalcError> { | 195 | pub fn eval_math_expression(input: &str, prev_ans: Option<f64>) -> Result<f64, CalcError> { |
195 | let input = input.trim(); | 196 | let input = input.trim().replace(" ", ""); |
196 | let input = input.replace(" ", ""); | 197 | if input == "help" { |
198 | return Err(CalcError::Help); | ||
199 | } | ||
197 | if input.is_empty() { | 200 | if input.is_empty() { |
198 | return Ok(0.); | 201 | return Ok(0.); |
199 | } | 202 | } |