You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

15 lines
402 B

use crate::error::ShellError;
use super::{Builtin, BuiltinConfig};
pub struct Pwd;
impl Builtin for Pwd {
fn execute(&mut self, _: &mut BuiltinConfig, _: Vec<String>) -> Result<(), ShellError> {
match std::env::current_dir() {
Ok(p) => println!("{}", p.display()),
Err(e) => return Err(ShellError::ExecuteFailure(e.to_string())),
}
Ok(())
}
}