Add a file to the context collection. This method: 1. Reads the content of the file 2. Adds the (filename, content) pair to the context collection # Arguments `path` - The path to the file `context_files` - The collection to add the file to # Returns A Result indicating success or an error
(os: &Os, path: &Path, context_files: &mut Vec<(String, String)>)
| 375 | /// # Returns |
| 376 | /// A Result indicating success or an error |
| 377 | async fn add_file_to_context(os: &Os, path: &Path, context_files: &mut Vec<(String, String)>) -> Result<()> { |
| 378 | let filename = path.to_string_lossy().to_string(); |
| 379 | let content = os.fs.read_to_string(path).await?; |
| 380 | context_files.push((filename, content)); |
| 381 | Ok(()) |
| 382 | } |
| 383 | |
| 384 | #[cfg(test)] |
| 385 | mod tests { |
no test coverage detected