Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure empty sections are parsed but empty #50

Merged
merged 1 commit into from
Apr 24, 2024

Conversation

belak
Copy link
Contributor

@belak belak commented Apr 23, 2024

Hello! We recently started using this library and noticed that empty sections don't show up via the .sections() method. This fixes that by inserting an empty HashMap when the section name is parsed, rather than waiting for the first value to be added.

I didn't add an option for it, but it seems like if you consider this a breaking change, it would be fairly easy to put behind an additional config value in the IniDefault type.

Fixes #37

I can also open issues for them, but what would your thoughts be on "has_section" and "create_section" methods? I notice neither of those prefixes is used, so another name might work better, I just wasn't sure what. "insert_section" would be an option, but that's sort of implied to take a Map, which wasn't what I was going for... though I suppose it would work.

Copy link
Owner

@QEDK QEDK left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@QEDK QEDK merged commit 1f6f20c into QEDK:master Apr 24, 2024
3 checks passed
@belak belak deleted the belak/parse-empty-sections branch April 25, 2024 06:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support sections with no keys
2 participants