Skip to content

Commit bf5a9c2

Browse files
Feat: Add patterns to ignore files in the reference directory (#86)
1 parent 04159b2 commit bf5a9c2

File tree

6 files changed

+585
-84
lines changed

6 files changed

+585
-84
lines changed

README.md

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ specific_args = {
174174
}
175175
```
176176

177-
And last but not least, it's possible to use regular expressions to associate specific arguments to
177+
Another possibility is to use regular expressions to associate specific arguments to
178178
a set of files:
179179

180180
```python
@@ -186,6 +186,22 @@ specific_args = {
186186
}
187187
```
188188

189+
And last but not least, it's possible to filter files from the reference directory (for example
190+
because the reference directory contains temporary files that should not be compared). For
191+
example, the following code will ignore all files whose name does not start with `file_` and does
192+
not ends with `_tmp.yaml`:
193+
194+
```python
195+
import dir_content_diff
196+
197+
dir_content_diff.compare_trees(
198+
"reference_dir",
199+
"compared_dir",
200+
include_patterns=[r"file_.*"],
201+
exclude_patterns=[r".*_tmp\.yaml"],
202+
)
203+
```
204+
189205

190206
### Export formatted data
191207

0 commit comments

Comments
 (0)