added simple history support

This commit is contained in:
Erin 2022-02-14 00:17:55 +01:00 committed by ondra05
parent 43ae772894
commit 0615091b3c

View file

@ -15,6 +15,8 @@ pub fn repl(ast_print: bool) {
match rl.readline(if partial.is_some() { ">> " } else { ":: " }) { match rl.readline(if partial.is_some() { ">> " } else { ":: " }) {
Ok(readline) => { Ok(readline) => {
let readline = readline.trim_end(); let readline = readline.trim_end();
rl.add_history_entry(readline);
let partial_data = match partial { let partial_data = match partial {
Some(line) => line + &readline, Some(line) => line + &readline,
None => readline.to_owned(), None => readline.to_owned(),