From a643c8a792d71e45ba25d73e7e6a1f6aa9f7827c Mon Sep 17 00:00:00 2001 From: greg Date: Thu, 1 Mar 2018 02:49:14 -0800 Subject: [PATCH] Add history saving --- .gitignore | 1 + schala-lib/src/lib.rs | 3 +++ 2 files changed, 4 insertions(+) diff --git a/.gitignore b/.gitignore index 31492a4..b8518cb 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ Cargo.lock target .schala_repl +.schala_history diff --git a/schala-lib/src/lib.rs b/schala-lib/src/lib.rs index 807ed9e..e95a391 100644 --- a/schala-lib/src/lib.rs +++ b/schala-lib/src/lib.rs @@ -167,6 +167,8 @@ impl Repl { fn run(&mut self) { println!("MetaInterpreter v 0.05"); + self.console.get_history().load(".schala_history").unwrap_or(()); + loop { let language_name = self.languages[self.current_language_index].get_language_name(); let prompt_str = format!("{} >> ", language_name); @@ -187,6 +189,7 @@ impl Repl { _ => (), } } + self.console.get_history().save(".schala_history").unwrap_or(()); self.save_options(); println!("Exiting..."); }