https://github.com/fs02/gitignore-parser
.gitignore parser library for kotlin
https://github.com/fs02/gitignore-parser
Last synced: over 1 year ago
JSON representation
.gitignore parser library for kotlin
- Host: GitHub
- URL: https://github.com/fs02/gitignore-parser
- Owner: Fs02
- License: mit
- Created: 2023-12-02T06:20:30.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2024-02-14T05:11:49.000Z (over 2 years ago)
- Last Synced: 2024-05-01T12:16:45.220Z (about 2 years ago)
- Language: Kotlin
- Size: 73.2 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# gitignore-parser
[](https://jitpack.io/#Fs02/gitignore-parser)
A spec-compliant gitignore parser for Kotlin/JVM.
Kotlin port from: https://github.com/mherrmann/gitignore_parser
## Download
```
repositories {
maven { url 'https://jitpack.io' }
}
dependencies {
implementation 'com.github.fs02:gitignore-parser:1.0.0'
}
```
## Usage
Suppose `/home/project/.gitignore` contains the following:
```
# Ignore Gradle project-specific cache directory
.gradle
# Ignore Gradle build output directory
build
```
Then:
```kotlin
import com.github.fs02.gitignore.parser.Gitignore
import java.nio.file.Path
fun main() {
// Example usage
val gitignorePath = Path.of("/home/project/.gitignore")
val gitignore = Gitignore(gitignorePath)
println("Is Ignored: ${gitignore.match(Path.of("/home/project/build"))}")
}
```