// We set the file name, then check if we set it, and if we set it properly, we load it in
ifcon.history.file_name().is_some(){
con.history.load_history().unwrap();
}
loop{
loop{
// Reads the line, the first arg is the prompt, the second arg is a function called on every bit of text leaving liner, and the third is called on every key press
// Reads the line, the first arg is the prompt, the second arg is a function called on every bit of text leaving liner, and the third is called on every key press
...
@@ -94,7 +95,7 @@ fn main() {
...
@@ -94,7 +95,7 @@ fn main() {
_=>{}
_=>{}
}
}
// If we typed nothing, don't continue down to pushing to history
// If we typed nothing, don't continue down to pushing to history
ifres.is_empty(){
ifres.is_empty(){
break;
break;
}
}
...
@@ -115,7 +116,6 @@ fn main() {
...
@@ -115,7 +116,6 @@ fn main() {
_=>{
_=>{
// Ensure that all writes to the history file
// Ensure that all writes to the history file
// are written before exiting due to error.
// are written before exiting due to error.
con.history.commit_history();
panic!("error: {:?}",e)
panic!("error: {:?}",e)
},
},
}
}
...
@@ -126,5 +126,5 @@ fn main() {
...
@@ -126,5 +126,5 @@ fn main() {
}
}
// Ensure that all writes to the history file are written before exiting.
// Ensure that all writes to the history file are written before exiting.