https://github.com/hpfxd/configurate-eo-yaml
YAML configuration loader for Configurate utilizing eo-yaml
https://github.com/hpfxd/configurate-eo-yaml
configurate java yaml
Last synced: 3 months ago
JSON representation
YAML configuration loader for Configurate utilizing eo-yaml
- Host: GitHub
- URL: https://github.com/hpfxd/configurate-eo-yaml
- Owner: hpfxd
- License: mit
- Created: 2021-10-31T21:21:19.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2021-11-03T18:47:05.000Z (over 3 years ago)
- Last Synced: 2025-03-18T04:39:33.592Z (3 months ago)
- Topics: configurate, java, yaml
- Language: Java
- Homepage:
- Size: 64.5 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# configurate-eo-yaml
YAML configuration loader for [Configurate](https://github.com/SpongePowered/Configurate/)
using [eo-yaml](https://github.com/decorators-squad/eo-yaml/).## Why?
Currently in Configurate, the YAML loader which is implemented using SnakeYAML does not support writing comments.
The only loaders that support round-tripping comments are Hocon and XML. I personally find XML to be a bit annoying to
use for configurations (looking at you Maven...), and the Hocon loader uses a Map implementation internally that does
not preserve the ordering of entries, which means when saving, the options are all over the place.eo-yaml both properly preserves entry ordering, and supports round-tripping comments. :)
## Usage
**Gradle**
```kotlin
repositories {
mavenCentral()
}dependencies {
implementation("com.hpfxd.configurate:configurate-eo-yaml:1.0.0")
}
```**Maven**
```xml
com.hpfxd.configurate
configurate-eo-yaml
1.0.0
```
Once you have the library imported into your project, you can just use it like any other Configurate loader:
```java
EOYamlConfigurationLoader loader = EOYamlConfigurationLoader.builder()
.file(new File("./config.yml"))
.build();
```The loader only has one unique option: **guessIndentation**.
See [the eo-yaml wiki](https://github.com/decorators-squad/eo-yaml/wiki/Validation-of-Indentation) for more information.
You can set this option by calling `guessIndentation(boolean)` on the builder.
By default, this option is set to `false`.