MCPcopy Create free account
hub / github.com/aws/amazon-q-developer-cli / remove_paths

Method remove_paths

crates/chat-cli/src/cli/chat/context.rs:168–179  ·  view source on GitHub ↗

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>)

Source from the content-addressed store, hash-verified

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) {

Callers 1

executeMethod · 0.80

Calls 3

get_path_as_strMethod · 0.80
lenMethod · 0.45
as_strMethod · 0.45

Tested by

no test coverage detected