Refactor history handling: store only save and usefull commands, save them in LKEval state, do not safe pass command into history.

This commit is contained in:
Oleksandr Kozachuk
2023-01-07 13:16:47 +01:00
parent 4ee1d38be7
commit 2b56aed28e
4 changed files with 90 additions and 56 deletions
+2 -2
View File
@@ -206,7 +206,7 @@ impl<'a> LKEval<'a> {
pub fn cmd_pb(&self, out: &LKOut, command: &String) {
match command_parser::cmd(command) {
Ok(cmd) => {
let print = LKEval::new(cmd, self.state.clone(), self.read_password).eval();
let print = LKEval::new(self.rl.clone(), cmd, self.state.clone(), self.read_password).eval();
let data = print.out.data();
print.out.copy_err(&out);
if data.len() > 0 {
@@ -257,7 +257,7 @@ impl<'a> LKEval<'a> {
match command_parser::script(&script) {
Ok(cmd_list) => {
for cmd in cmd_list {
let print = LKEval::new(cmd, self.state.clone(), password).eval();
let print = LKEval::new(self.rl.clone(), cmd, self.state.clone(), password).eval();
print.out.copy(&out);
if print.quit {
return true;