Skip to content

Commit 2513699

Browse files
authored
Merge pull request #1 from elifarley/elifarley-patch-1
Update README.md
2 parents 9441e85 + acc0a13 commit 2513699

File tree

1 file changed

+17
-13
lines changed

1 file changed

+17
-13
lines changed

README.md

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
# Orgecc File Matcher
22

3+
A Python library and CLI tool for Git-compatible file matching and directory traversal.
4+
35
[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
6+
[![Python Versions](https://img.shields.io/pypi/pyversions/orgecc-file-matcher.svg)](https://pypi.org/project/orgecc-file-matcher/)
47
[![CI](https://github.com/yourusername/file-matcher-python/actions/workflows/test.yml/badge.svg)](https://github.com/yourusername/file-matcher-python/actions/workflows/test.yml)
58
[![PyPI](https://img.shields.io/pypi/v/orgecc-file-matcher)](https://pypi.org/project/orgecc-file-matcher/)
69
[![PyPI version](https://badge.fury.io/py/orgecc-file-matcher.svg)](https://pypi.org/project/orgecc-file-matcher/)
7-
[![Python Versions](https://img.shields.io/pypi/pyversions/orgecc-file-matcher.svg)](https://pypi.org/project/orgecc-file-matcher/)
810
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
911

1012
A versatile command-line, Python library and toolkit for `.gitignore`-style file matching, designed to meet four key goals:
@@ -16,21 +18,17 @@ A versatile command-line, Python library and toolkit for `.gitignore`-style file
1618

1719
## Features
1820

19-
- **Git-Compatible Matching**: The pure Python matcher passes all test cases, unlike many other libraries.
21+
- **Git-Compatible Matching**: Pure Python implementation passes all test cases, ensuring 100% compatibility with Git's behavior.
2022
- **Multiple Implementations**: Choose from pure Python, external libraries ([gitignorefile](https://github.com/excitoon/gitignorefile), [pathspec](https://github.com/excitoon/gitignorefile)), or native Git integration.
21-
- **[Comprehensive Test Suite](#unit-testing)**: Includes a [corpus of test cases](tests/corpus) to validate `.gitignore` matching behavior.
23+
- **Multiple Implementations** (see available options in [MatcherImplementation](src/orgecc/filematcher/__init__.py)):
24+
- **Pure Python**: No external dependencies. Aims at 100% Git compatibility.
25+
- **Native Git Integration**: Internally calls `git check-ignore -v`. The unit tests are adjusted according to this implementation.
26+
- **External Libraries**: Supports [gitignorefile](https://github.com/excitoon/gitignorefile) and [pathspec](https://github.com/cpburnz/python-path-specification).
27+
- **[Comprehensive Test Suite](#unit-testing)**: Includes a [test corpus](tests/corpus) for validating `.gitignore` matching behavior.
2228
- **Tree-Sitter-Inspired Testing**: The corpus files follow the same rigorous testing principles used by [Tree-Sitter](https://tree-sitter.github.io/tree-sitter/), ensuring high-quality and reliable test coverage.
2329
- **Efficient Directory Traversal**: A file walker that skips ignored files and directories.
2430
- **Cross-Platform**: Works seamlessly on Windows, macOS, and Linux.
2531

26-
## Supported Implementations
27-
28-
See available options in [MatcherImplementation](src/orgecc/filematcher/__init__.py)
29-
30-
- **Pure Python**: No external dependencies. Aims at 100% Git compatibility.
31-
- **Native Git**: Use Git's built-in pattern matching (`git check-ignore -v`) for maximum compatibility. The unit tests are adjusted according to this implementation.
32-
- **External Libraries**: Leverage `gitignorefile` or `pathspec` for enhanced performance.
33-
3432
## Installation
3533

3634
Install via **pip**:
@@ -47,19 +45,22 @@ Use the Git-compatible pure Python matcher (the default):
4745

4846
```python
4947
from orgecc.filematcher import get_factory, MatcherImplementation
48+
from orgecc.filematcher.patterns import new_deny_pattern_source
5049

5150
factory = get_factory(MatcherImplementation.PURE_PYTHON)
52-
matcher = factory.pattern2matcher(patterns=["*.pyc", "build/"])
51+
patterns = new_deny_pattern_source(["*.pyc", "build/"])
52+
matcher = factory.pattern2matcher(patterns)
5353
result = matcher.match("path/to/file.pyc")
5454
print(result.matches) # True or False, matching Git's behavior
5555
```
56+
5657
### File Walker
5758

5859
Traverse directories while respecting `.gitignore` rules:
5960

6061
#### CLI Tool for _macOS_, _Linux_ and _Windows_
61-
You can use the provided command-line tool:
6262

63+
Use the provided CLI tool to traverse directories while respecting .gitignore rules:
6364

6465
```shell
6566
file-walker --help
@@ -92,6 +93,8 @@ from orgecc.filematcher.walker import DirectoryWalker
9293
walker = DirectoryWalker()
9394
for file in walker.walk("path/to/directory"):
9495
print(file)
96+
print(walker.yielded_count)
97+
print(walker.ignored_count)
9598
```
9699

97100
### Unit Testing
@@ -204,3 +207,4 @@ factory = get_factory(MatcherImplementation.EXTLIB_GITIGNOREFILE)
204207
## License
205208

206209
This project is licensed under the Apache 2 License - see the [LICENSE](LICENSE) file for details.
210+

0 commit comments

Comments
 (0)