satch

Crates.iosatch
lib.rssatch
version0.1.0
created_at2025-08-09 04:08:09.44602+00
updated_at2025-08-09 04:08:09.44602+00
descriptionA high-performance Rust implementation of picomatch/micromatch pattern matching
homepagehttps://github.com/ushironoko/satch
repositoryhttps://github.com/ushironoko/satch
max_upload_size
id1787561
size67,035
ushironoko (ushironoko)

documentation

https://docs.rs/satch

README

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

Commit count: 0

cargo fmt