AuthMe / ConfigMe

A simple configuration management library for any Java project!
MIT License
37 stars 16 forks source link

Indentation size and blank lines #127

Closed LichtHund closed 4 years ago

LichtHund commented 4 years ago

Hello! I wanted to ask if it's currently possible to change the indentation size (currently it's 4 spaces, I would like to make it 2) and to add a blank line to separate sections. I managed to make this changes on my fork, but wanted to confirm if it was already possible or not because the way I did it seemed hacky.

ljacqu commented 4 years ago

Hi! It's not possible to change the indention so far. I like the changes you've done on your fork—I would just move the indention parameter as a property inside YamlFileResourceOptions though.

Blank lines can be configured with the YamlFileResourceOptions#numberOfLinesBeforeFunction but that's between properties and doesn't allow empty lines between comments. I hadn't realized this would be desired :) I don't have a good idea there besides adding another Function to the YamlFileResourceOptions, unless PathElement (the argument the existing function already takes) is changed to represent either a YAML element or a comment.

If you agree I'd propose that you create a pull request for the indention issue, and for the second matter I'll come up with a solution and ask you for feedback.

LichtHund commented 4 years ago

There you go I made the pull request with the suggestions you said. Also I found that currently if you add a simple \n to the @Comment annotation it does exactly what I want for the empty lines. However it needs to be the first thing, doing something like @Comment({"Test", "\n"}) will result in a blank line with # in it. So I am fine with how that is right now.

129

ljacqu commented 4 years ago

@ipsk Once again thanks for the PR! For the comment thing I have to say I like your solution and since you said it was all you need I'll not investigate it further, unless you'd want to configure it on a more general level.