use crate::errors::ShellError; use crate::object::{dir_entry_dict, Value}; use crate::prelude::*; pub fn ls(args: CommandArgs) -> Result { let cwd = args.env.lock().unwrap().cwd().to_path_buf(); let entries = std::fs::read_dir(&cwd).map_err(|e| ShellError::string(format!("{:?}", e)))?; let mut shell_entries = VecDeque::new(); for entry in entries { let value = Value::Object(dir_entry_dict(&entry?)?); shell_entries.push_back(ReturnValue::Value(value)) } Ok(shell_entries.boxed()) }