+ // if cannot convert to string return error
+ if hist_file.to_str ().is_none () {
+ return Err (HOMEDIR_NOT_FOUND.to_string());
+ }
+
+ // return the history file path as a string
+ let hist_file_path = String::from (hist_file.to_str().unwrap());
+ return Ok (hist_file_path);
+}
+
+// Interactive mode - display the prompt and evaluate expressions entered into
+// the prompt - until user quits
+fn run_interactive_mode (match_num : ®ex::Regex) {
+ // get a line from input and evaluate it
+ 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 {
+ if rl.load_history (&hist_file.unwrap ()).is_err () {
+ eprintln! ("{}", HISTORY_FILE_NOT_FOUND.purple());
+ }
+ }
+ // loop until a blank line is received
+ loop {
+ expr.clear ();
+
+ let line = rl.readline ("evpf> ");
+ if line.is_err () {
+ break;
+ }
+ let hist = line.unwrap ();
+ rl.add_history_entry (&hist);
+ expr.push_str (&hist);
+
+ if expr == "q" || expr == "Q" {
+ // quit if the expression is q or Qs
+ break;
+ } else if expr == "?" || expr == "h" || expr == "H" {
+ // display help text
+ for text in HELP_TEXT.iter() {
+ println! ("{}", text.cyan() );