use hackshell::{Hackshell, error::HackshellError};
fn main() -> Result<(), Box<dyn std::error::Error>> {
let shell = Hackshell::new("basic> ")?;
shell.set_history_file("history.txt")?;
loop {
match shell.run() {
Ok(_) => {}
Err(e) => {
if matches!(e, HackshellError::Eof)
|| matches!(e, HackshellError::Interrupted)
|| matches!(e, HackshellError::Exit)
{
break;
}
eprintln!("Error: {}", e);
}
}
}
Ok(())
}