
Line-by-line transliteration of an upstream search-tool ignore crate: gitignore/.ignore/.rgignore parsing, glob and regex path matching, ignore-rule application, fast parallel recursive directory traversal, provenance headers.
This is a Kotlin Multiplatform line-by-line transliteration port of the Rust crate ignore from BurntSushi/ripgrep.
The ignore crate provides a fast recursive directory iterator that respects various filters such as globs, file types, and .gitignore files. This library also provides lower-level direct access to gitignore, override, and file type matchers.
Original Project: Based on BurntSushi/ripgrep/crates/ignore (upstream crate: ignore). All design credit belongs to Andrew Gallant and the ripgrep authors.
Add to your build.gradle.kts:
kotlin {
sourceSets {
commonMain.dependencies {
implementation("io.github.kotlinmania:ignore-kotlin:0.1.0")
}
}
}Recursively traverse the directory while automatically filtering out files and directories according to ignore rules found in .ignore, .gitignore, and .git/info/exclude:
import io.github.kotlinmania.ignore.Walk
for (result in Walk.new("./")) {
if (result.isSuccess()) {
println(result.getOrNull()?.path())
} else {
println("ERROR: ${result.error()}")
}
}By default, the recursive iterator ignores hidden files and directories. This can be configured using WalkBuilder:
import io.github.kotlinmania.ignore.WalkBuilder
val walk =
WalkBuilder("./")
.hidden(false)
.maxDepth(3)
.build()
for (result in walk) {
result.getOrNull()?.let { entry ->
println("${entry.path()} (depth ${entry.depth()})")
}
}Direct access to gitignore matching:
import io.github.kotlinmania.ignore.GitignoreBuilder
val gitignore =
GitignoreBuilder("/path/to/root")
.addLine(null, "*.log")
.addLine(null, "!important.log")
.build()
val match = gitignore.matched("app.log", isDir = false)
if (match.isIgnore()) {
println("File is ignored")
}macosArm64)iosArm64, iosSimulatorArm64, tvosArm64, tvosSimulatorArm64, watchosDeviceArm64, watchosSimulatorArm64, Swift Export + XCFramework)linuxArm64, linuxX64)mingwX64)wasmJs, wasmWasi)Dual-licensed under MIT or UNLICENSE, matching upstream ignore.
Original work Copyright (c) Andrew Gallant (BurntSushi).
Kotlin port Copyright (c) 2026 Sydney Renee and The Solace Project.
This is a Kotlin Multiplatform line-by-line transliteration port of the Rust crate ignore from BurntSushi/ripgrep.
The ignore crate provides a fast recursive directory iterator that respects various filters such as globs, file types, and .gitignore files. This library also provides lower-level direct access to gitignore, override, and file type matchers.
Original Project: Based on BurntSushi/ripgrep/crates/ignore (upstream crate: ignore). All design credit belongs to Andrew Gallant and the ripgrep authors.
Add to your build.gradle.kts:
kotlin {
sourceSets {
commonMain.dependencies {
implementation("io.github.kotlinmania:ignore-kotlin:0.1.0")
}
}
}Recursively traverse the directory while automatically filtering out files and directories according to ignore rules found in .ignore, .gitignore, and .git/info/exclude:
import io.github.kotlinmania.ignore.Walk
for (result in Walk.new("./")) {
if (result.isSuccess()) {
println(result.getOrNull()?.path())
} else {
println("ERROR: ${result.error()}")
}
}By default, the recursive iterator ignores hidden files and directories. This can be configured using WalkBuilder:
import io.github.kotlinmania.ignore.WalkBuilder
val walk =
WalkBuilder("./")
.hidden(false)
.maxDepth(3)
.build()
for (result in walk) {
result.getOrNull()?.let { entry ->
println("${entry.path()} (depth ${entry.depth()})")
}
}Direct access to gitignore matching:
import io.github.kotlinmania.ignore.GitignoreBuilder
val gitignore =
GitignoreBuilder("/path/to/root")
.addLine(null, "*.log")
.addLine(null, "!important.log")
.build()
val match = gitignore.matched("app.log", isDir = false)
if (match.isIgnore()) {
println("File is ignored")
}macosArm64)iosArm64, iosSimulatorArm64, tvosArm64, tvosSimulatorArm64, watchosDeviceArm64, watchosSimulatorArm64, Swift Export + XCFramework)linuxArm64, linuxX64)mingwX64)wasmJs, wasmWasi)Dual-licensed under MIT or UNLICENSE, matching upstream ignore.
Original work Copyright (c) Andrew Gallant (BurntSushi).
Kotlin port Copyright (c) 2026 Sydney Renee and The Solace Project.