Browse Source

refactoring: remove unnecessary internal keyword parameter

main
fdai7381 2 years ago
committed by fdai7451
parent
commit
2f062017c6
  1. 2
      src/builtins/cd.rs
  2. 2
      src/builtins/mod.rs

2
src/builtins/cd.rs

@ -2,7 +2,7 @@ use std::env::set_current_dir;
use crate::error::ShellError;
pub fn run(keyword: &str, args: &[&str]) -> Result<(), ShellError> {
pub fn run(args: &[&str]) -> Result<(), ShellError> {
set_current_dir(args[0]);
Ok(())
}

2
src/builtins/mod.rs

@ -9,7 +9,7 @@ pub fn is_builtin(keyword: &str) -> bool {
pub fn execute_builtin(keyword: &str, args: &[&str]) -> Result<(), ShellError> {
match keyword {
"cd" => cd::run(keyword, args)?,
"cd" => cd::run(args)?,
_ => {}
}
Ok(())

Loading…
Cancel
Save