|
|
@ -1,7 +1,8 @@ |
|
|
|
use crate::error::ShellError;
|
|
|
|
mod cd;
|
|
|
|
mod exit;
|
|
|
|
|
|
|
|
const BUILTINS: &[&str] = &["cd"];
|
|
|
|
const BUILTINS: &[&str] = &["exit", "cd"];
|
|
|
|
|
|
|
|
pub fn is_builtin(keyword: &str) -> bool {
|
|
|
|
BUILTINS.contains(&keyword)
|
|
|
@ -9,6 +10,7 @@ pub fn is_builtin(keyword: &str) -> bool { |
|
|
|
|
|
|
|
pub fn execute_builtin(keyword: &str, args: &[&str]) -> Result<(), ShellError> {
|
|
|
|
match keyword {
|
|
|
|
"exit" => exit::run()?,
|
|
|
|
"cd" => cd::run(args)?,
|
|
|
|
_ => {}
|
|
|
|
}
|
|
|
|