Added hist number to prompt, Arrows working

This commit is contained in:
Justine
2022-12-23 17:35:20 +01:00
parent 8c92b82656
commit c65a6aa4d0
4 changed files with 53 additions and 119 deletions

View File

@ -34,6 +34,16 @@ pub fn get_history_number() -> Result<i32, std::io::Error> {
return Ok(number);
}
pub fn get_curr_history_number() -> i32 {
//Returns CURRENT history number, AKA the one for the command we are typing
let mynumber = match get_history_number() {
Ok(n) => n + 1,
Err(e) => 1,
};
return mynumber;
}
pub fn get_history() -> Result<String, std::io::Error> {
let filepath = dirs::home_dir().unwrap().join("history.sqish");
let file = File::open(filepath)?;