scribe-patterns 0.2.0

Advanced pattern matching and search algorithms for Scribe
Documentation

Scribe Patterns

Advanced pattern matching and search algorithms for the Scribe library. This crate provides high-performance pattern matching capabilities including glob patterns, gitignore integration, and flexible include/exclude logic.

Features

  • High-Performance Glob Matching: Using globset for efficient pattern compilation
  • Gitignore Integration: Full gitignore syntax support with proper precedence
  • Include/Exclude Logic: Complex pattern combinations with comma-separated input
  • Path Normalization: Cross-platform path handling and matching
  • Pattern Validation: Comprehensive error handling and pattern validation
  • Caching: Efficient pattern compilation and matching with caching

Usage

use scribe_patterns::{PatternMatcherBuilder, MatchResult};
use std::path::Path;

# fn example() -> anyhow::Result<()> {
// Create a combined matcher with glob and gitignore patterns
let mut matcher = PatternMatcherBuilder::new()
    .include("src/**/*.rs")
    .exclude("target/**")
    .respect_gitignore(true)
    .base_path(".")
    .build()?;

// Test if a path matches
let path = Path::new("src/lib.rs");
if matcher.should_process(path)? {
    println!("Path is included: {}", path.display());
}
# Ok(())
# }