X-Git-Url: https://harishankar.org/repos/?p=evpf.git;a=blobdiff_plain;f=src%2Fmain.rs;h=51ea94eb5e681337e5b6ecb386c8f81771fcb528;hp=8e54265b3c76a73fe7ff037aed19063e77ff94ef;hb=975d99c3ed4aa48ca49857841ff80f4e732c3b1b;hpb=a86a7c0712840275401e5ccd79322f3575b918fb diff --git a/src/main.rs b/src/main.rs index 8e54265..51ea94e 100644 --- a/src/main.rs +++ b/src/main.rs @@ -195,7 +195,10 @@ fn run_interactive_mode (match_num : ®ex::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 { @@ -251,14 +254,16 @@ fn run_interactive_mode (match_num : ®ex::Regex) { if rl.save_history (&hist_file.unwrap()).is_err () { eprintln! ("{}", SAVE_HISTORY_ERROR); } - } + } else { + eprintln! ("{}", &hist_file.unwrap_err()); + } } fn main() { // collect the command line arguments - if any let args : Vec = 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