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

Feature Request: Allow setting duplicated properties #128

Closed
RouHim opened this issue Apr 3, 2024 · 1 comment
Closed

Feature Request: Allow setting duplicated properties #128

RouHim opened this issue Apr 3, 2024 · 1 comment

Comments

@RouHim
Copy link
Contributor

RouHim commented Apr 3, 2024

Hello thank you for this great library,
I'm currently working on a project where I need to add duplicate properties:

[foo]
bar=1
bar=2

I see that there is a get_all() for property retrieval:

ini.section("foo").unwrap()
   .get_all("bar");

which would return all bar entries.

When I now try to use the setter API to add entries, it would always overwrite the entry, which is clearly documented, thanks for that.

So I have the proposal to introduce a new API that works like set but allows duplicate entries:

ini
    .with_section("foo")
    .add("bar", "1")
    .add("bar", "2");

which would lead to my first listing.

@RouHim
Copy link
Contributor Author

RouHim commented Apr 3, 2024

I would like to provide a PR if that's ok for you.

@RouHim RouHim changed the title [Feature Request] Allow setting duplicated properties Feature Request: Allow setting duplicated properties Apr 3, 2024
zonyitoo pushed a commit that referenced this issue Apr 12, 2024
* feat(lib): Allow adding / appending duplicate entries

* feat(tests): Add tests for duplicate properties

* feat(tests): Add more unit tests

* chore(tests): Rename test

* fix: new feature tests on windows

* Revert "fix: new feature tests on windows"

This reverts commit a398464.

* fix: broken test on windows

* fix: broken test on windows (hopefully)

---------

Co-authored-by: Rouven Himmelstein <r.himmelstein@tarent.de>
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

No branches or pull requests

2 participants