A .gitgnore-pattern-based glob library for Kotlin and/or Java 8+.
Used by/Extracted from ktlint.
<dependency>
<groupId>com.github.shyiko.klob</groupId>
<artifactId>klob</artifactId>
<version>0.2.0</version>
<!-- omit classifier below if you plan to use this library in koltin -->
<classifier>kalvanized</classifier>
</dependency>
(java)
# find all files matching the patterns (! = exclude)
Path path = Glob.from("src/**/*.kt", "!src/generated")
.iterate(Paths.get("."))
/*: Iterator<Path> */
.next()
# match directories only
String home = System.getProperty("user.home")
Path path = Glob.from(".IntelliJIdea*/config")
.iterate(Paths.get(home), Glob.IterationOption.SKIP_CHILDREN, Glob.IterationOption.DIRECTORY)
/*: Iterator<Path> */
.next()
git clone https://github.com/shyiko/klob && cd klob
./mvnw # shows how to build, test, etc. project
All code, unless specified otherwise, is licensed under the MIT license.
Copyright (c) 2017 Stanley Shyiko.