Remove paths from the context configuration. # Arguments `paths` - List of paths to remove # Returns A Result indicating success or an error
(&mut self, paths: Vec<String>)
| 166 | /// # Returns |
| 167 | /// A Result indicating success or an error |
| 168 | pub fn remove_paths(&mut self, paths: Vec<String>) -> Result<()> { |
| 169 | // Remove each path if it exists |
| 170 | let old_path_num = self.paths.len(); |
| 171 | self.paths |
| 172 | .retain(|p| !paths.iter().any(|path| path.as_str() == p.get_path_as_str())); |
| 173 | |
| 174 | if old_path_num == self.paths.len() { |
| 175 | return Err(eyre!("None of the specified paths were found in the context")); |
| 176 | } |
| 177 | |
| 178 | Ok(()) |
| 179 | } |
| 180 | |
| 181 | /// Clear all paths from the context configuration. |
| 182 | pub fn clear(&mut self) { |
no test coverage detected