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