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

Iterate over the keys of a section request. #32

Open
djve60 opened this issue Aug 26, 2022 · 2 comments
Open

Iterate over the keys of a section request. #32

djve60 opened this issue Aug 26, 2022 · 2 comments
Labels
enhancement New feature or request hacktoberfest

Comments

@djve60
Copy link

djve60 commented Aug 26, 2022

I have a set of keys in an ini file in once section that I need to apply the same rules to and update the data structure, in memory.

With the current code base I need to know the keys in advance. I would by much nicer if I could do something like:

for key in config.get_keys("section_name") {
//do something here.
}

Then, with the sections() function dumping the data while debugging is also trivial.

@QEDK QEDK added the enhancement New feature or request label Aug 28, 2022
@QEDK
Copy link
Owner

QEDK commented Aug 29, 2022

@djve60 The underlying impl is a HashMap you can iterate over the keys by simply using the underlying hashmap.
But you are correct, we should have a function to return a section, I'll plan it for next release.

@djve60
Copy link
Author

djve60 commented Aug 29, 2022

Yes, I'm using iteration before I posted. That's why it's just an enhancement/new feature. But to match the sections() I felt that there should be a matching keys(). Glad you agree. It's not stopping my code but I'll update when the new call is ready.

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request hacktoberfest
Projects
None yet
Development

No branches or pull requests

2 participants