Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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: about 1 month ago
JSON representation

YAML configuration loader for Configurate utilizing eo-yaml

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`.