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

Function add_gitignore_globs

crates/chat-cli/src/util/paths.rs:195–202  ·  view source on GitHub ↗

Given a globset builder and a path, build globs for both the file and directory patterns This is needed because by default glob does not match children of a dir so we need both patterns to exist in a globset.

(builder: &mut GlobSetBuilder, path: &str)

Source from the content-addressed store, hash-verified

193/// This is needed because by default glob does not match children of a dir so we need both
194/// patterns to exist in a globset.
195pub fn add_gitignore_globs(builder: &mut GlobSetBuilder, path: &str) -> Result<()> {
196 let glob_for_file = Glob::new(path)?;
197 let dir_pattern: String = format!("{}/**", path.trim_end_matches('/'));
198 let glob_for_dir = Glob::new(&dir_pattern)?;
199 builder.add(glob_for_file);
200 builder.add(glob_for_dir);
201 Ok(())
202}
203
204/// Generate a unique identifier for an agent based on its path and name
205/// Path resolver with hierarchy-aware methods

Callers 2

eval_permMethod · 0.85
eval_permMethod · 0.85

Calls 1

addMethod · 0.45

Tested by

no test coverage detected