Added support for negative numbers
[evpf.git] / src / main.rs
index 8e54265..d44387c 100644 (file)
@@ -195,7 +195,10 @@ fn run_interactive_mode (match_num : &regex::Regex) {
        let mut expr = String::new ();
 
        let mut rl = Editor::<()>::new ();
+       
+       // load the history file
        let hist_file = get_history_file ();
+       // if unable to load the history file, display the appropriate error
        if hist_file.is_err () {
                eprintln! ("{}", &hist_file.unwrap_err());
        } else {
@@ -258,7 +261,7 @@ fn main() {
        // collect the command line arguments - if any 
        let args : Vec<String> = env::args().collect ();
        // regular expression to match a number 
-       let match_num = Regex::new (r"^\d+?\.*?\d*?$").unwrap ();
+       let match_num = Regex::new (r"^\-?\d+?\.*?\d*?$").unwrap ();
        
        if args.len () > 1 {
        // if arguments are provided run in command line mode - i.e. print the