@ -1,3 +1,4 @@
pub enum ShellError {
EmptyLine,
Execute(String),
}
@ -5,6 +5,9 @@ use crate::error::ShellError::Execute;
use crate::parse::parse_line;
pub fn interpret(line: &str) -> Result<(), ShellError> {
if line.is_empty() {
return Err(ShellError::EmptyLine);
let (keyword, args) = parse_line(line);
let mut command = Command::new(keyword);
@ -21,6 +21,9 @@ fn main() -> Result<()> {
match readline {
Ok(line) => match interpret(&line) {
Ok(_) => {}
Err(ShellError::EmptyLine) => {
continue;
Err(ShellError::Execute(err)) => {
eprintln!("{}", err)