Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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
- Host: GitHub
- URL: https://github.com/hpfxd/configurate-eo-yaml
- Owner: hpfxd
- License: mit
- Created: 2021-10-31T21:21:19.000Z (about 3 years ago)
- Default Branch: master
- Last Pushed: 2021-11-03T18:47:05.000Z (about 3 years ago)
- Last Synced: 2024-09-30T23:04:14.974Z (about 2 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`.