use anyhow::Result; use rustyline_filehelper::setup_editor; fn main() -> Result<()> { // Specify allowed file extensions (optional) let allowed_extensions = Some(vec!["txt".to_string(), "rs".to_string()]); // Setup editor with file completion and validation let mut rl = setup_editor(allowed_extensions, vec![])?; loop { let readline = rl.readline("> "); match readline { Ok(line) => { if line == "exit" { break; } println!("Line: {}", line); } Err(err) => { eprintln!("Error: {:?}", err); break; } } } Ok(()) }