copied rustyline's homework

This commit is contained in:
2025-06-02 03:18:13 -04:00
parent 3a0b171058
commit 72f7788abc
12 changed files with 441 additions and 5540 deletions

View File

@@ -22,11 +22,11 @@ fn get_prompt() -> ShResult<String> {
expand_prompt(&prompt)
}
pub fn read_line(edit_mode: FernEditMode) -> ShResult<String> {
pub fn readline(edit_mode: FernEditMode) -> ShResult<String> {
let prompt = get_prompt()?;
let mut reader: Box<dyn Readline> = match edit_mode {
FernEditMode::Vi => Box::new(FernVi::new(Some(prompt))?),
FernEditMode::Vi => Box::new(FernVi::new()),
FernEditMode::Emacs => todo!()
};
reader.readline()
reader.readline(Some(prompt))
}