Replies: 2 comments
-
Maybe It would help if you gave a concrete example. e.g., A directory tree along with the command you're running, the desired result and the actual result. |
Beta Was this translation helpful? Give feedback.
0 replies
-
An example: I would like to ignore every #[cfg(test)]
mod tests {
use globset::*;
#[test]
fn suffix() -> Result<(), Error> {
// "**/target/**" doesn't work either
let glob = GlobBuilder::new("**/target{,/**}")
.build()?
.compile_matcher();
assert!(glob.is_match("target")); // failed
assert!(glob.is_match("/target")); // failed
assert!(glob.is_match("target/"));
assert!(glob.is_match("/path/to/target")); // failed
assert!(glob.is_match("/path/to/target/"));
assert!(glob.is_match("/path/to/target/folder"));
assert!(glob.is_match("/path/to/target/folder/"));
assert!(!glob.is_match("targetfolder"));
Ok(())
}
} |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
It is not uncommon that we want to filter a folder itself and all of its children. But after #1756 was merged, we have to use two glob patterns to match the paths:
Are there any more elegant ways to achieve this?
Beta Was this translation helpful? Give feedback.
All reactions