satch 0.1.0

A high-performance Rust implementation of picomatch/micromatch pattern matching
Documentation
  • Coverage
  • 50%
    1 out of 2 items documented1 out of 2 items with examples
  • Size
  • Source code size: 66.53 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 1.6 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 23s Average build duration of successful builds.
  • all releases: 23s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Homepage
  • ushironoko/satch
    0 0 1
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • ushironoko

Satch

High-performance glob pattern matching for Rust and CLI.

Install

CLI

cargo install satch

Library

[dependencies]
satch = "0.1.0"

CLI Usage

Pattern Matching

# Basic matching
echo "src/main.rs" | satch "*.rs"              # NO MATCH
echo "src/main.rs" | satch --basename "*.rs"   # MATCH

# Multiple paths
satch "*.rs" src/main.rs lib.rs test.js        # Test multiple files

File Listing

# Current directory
satch --list "*.rs"                             # List matching files

# Recursive search
satch --list --recursive --basename "*.js"     # Find all .js files

Advanced Patterns

# Globstar patterns
satch --list --recursive "**/test/**/*.js"     # Find test files

# Character classes
satch --basename "[a-z]*.txt" file1.txt File2.txt  # Lowercase names only

Library Usage

Basic Matching

use satch::is_match;

// Simple patterns
is_match("file.js", "*.js");          // true
is_match("src/main.rs", "*.rs");      // false

// With basename matching needed
is_match("main.rs", "*.rs");          // true

Advanced Patterns

// Globstars
is_match("src/lib/utils.rs", "**/*.rs");       // true
is_match("deep/nested/file.js", "**/file.js"); // true

// Character classes
is_match("test1.js", "test[0-9].js");          // true
is_match("file.txt", "[a-z]*.txt");            // true
is_match("File.txt", "[a-z]*.txt");            // false (case sensitive)

Patterns

Pattern Example Matches
*.js main.js, test.js
**/*.js src/main.js, lib/test.js
src/**/*.rs src/lib/main.rs, src/utils.rs
[a-z]*.txt file.txt, readme.txt

Credits

Rust port of micromatch and picomatch.

License

MIT