Browse Source

feat: add exit shell error

main
fdai7381 2 years ago
parent
commit
5f399c0839
  1. 1
      src/error.rs
  2. 3
      src/main.rs

1
src/error.rs

@ -2,6 +2,7 @@ use std::process::Command;
pub enum ShellError { pub enum ShellError {
EmptyLine, EmptyLine,
Exit,
NotFound(Command), NotFound(Command),
ExecuteFailure(String), ExecuteFailure(String),
} }

3
src/main.rs

@ -25,6 +25,9 @@ fn main() -> Result<()> {
Err(ShellError::EmptyLine) => { Err(ShellError::EmptyLine) => {
continue; continue;
} }
Err(ShellError::Exit) => {
break;
}
Err(ShellError::NotFound(cmd)) => { Err(ShellError::NotFound(cmd)) => {
println!("{}: command not found", cmd.get_program().to_string_lossy()) println!("{}: command not found", cmd.get_program().to_string_lossy())
} }

Loading…
Cancel
Save