command_stream/commands/
pwd.rs1use crate::commands::CommandContext;
4use crate::utils::CommandResult;
5use std::env;
6
7pub async fn pwd(_ctx: CommandContext) -> CommandResult {
11 match env::current_dir() {
12 Ok(path) => CommandResult::success(format!("{}\n", path.display())),
13 Err(e) => CommandResult::error(format!("pwd: {}\n", e)),
14 }
15}
16
17#[cfg(test)]
18mod tests {
19 use super::*;
20
21 #[tokio::test]
22 async fn test_pwd() {
23 let ctx = CommandContext::new(vec![]);
24 let result = pwd(ctx).await;
25 assert!(result.is_success());
26 assert!(!result.stdout.is_empty());
27 }
28}