Add history saving

This commit is contained in:
greg 2018-03-01 02:49:14 -08:00
parent 69200048fa
commit a643c8a792
2 changed files with 4 additions and 0 deletions

1
.gitignore vendored
View File

@ -1,3 +1,4 @@
Cargo.lock
target
.schala_repl
.schala_history

View File

@ -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...");
}