Iggy is an ignore file processor for java. It was originally a part of swagger-codegen.
Given an ignore file, for example /your/directory/.ignore:
# This is an example ignore file
# Match everything below this directory
path/to/dir/**
# Match all Test files with all extensions
**/*Test*.*
# Match files with one character filename and extension
**/?.?
# Match all files beginning with first or second
**/{first*,second*}
This file can be read and evaluated like this:
IgnoreProcessor processor = new IgnoreProcessor("/your/directory");
processor.allowsFile(new File("path/to/dir/ignored"));//= false
processor.allowsFile(new File("other/path/to/dir/ignored"));//= true (DirectoryRule isn't implicitly recursive)
processor.allowsFile(new File("nested/test/SomeTest.java"));//= false
processor.allowsFile(new File("nested/a.b"));//= false
processor.allowsFile(new File("nested/abc.d"));//= true
processor.allowsFile(new File("nested/first.txt"));//= false
processor.allowsFile(new File("nested/second.txt"));//= false
processor.allowsFile(new File("nested/third.txt"));//= trueFile patterns follow closely to that of .gitignore. All ignore patterns allow glob patterns supported by java.nio.file.PathMatcher,
unless otherwise noted.
- Rooted file pattern:
/*.ext- Must exist in the root of the directory
- Must begin with a forward slash
/ - Supports
*or*.extpattern - Does not support
PathMatcherpatterns
- Directory Rule
- Matches against directories (
dir/) or directory contents (dir/**) - Must either end in
/or**
- Matches against directories (
- File Rule
- Matches an individual
filenameorfilename.ext - Supports all
PathMatcherpatterns
- Matches an individual
Similar to .gitignore processing, a double asterisk (**) can be used in place of a directory to indicate recursion.
For example:
path\to\**\file
matches both path\to\some\file and path\to\some\nested\file.
Single asterisks (*) match any characters within a pattern.
For example:
path\to\*file
matches both path\to\your_file and path\to\my_file, as well as path\to\file.
These are the base cases for most uses. For more details on supported glob patterns, see What is a Glob?
Apache 2.0.
see License