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
Add function to create a new titled section #69
Conversation
Signed-off-by: Jonas Johansson <jonasj76@gmail.com>
Signed-off-by: Jonas Johansson <jonasj76@gmail.com>
Great stuff, Jonas! Could you perhaps also add a unit test (see |
I have been using: Which is kind of ugly... |
Hmm, I think attempts to add a pre-existing section should fail. |
@peda-r Yeah this is cleaner. Hmm, you're right and it also touches upon a related problem of mine. A global |
I was thinking a flags argument to the new function, but I guess I don't care deeply about where the flags are specified... |
I just zoomed out a bit: a user that wants to add a section likely also want to be able to add other things as well. |
Signed-off-by: Jonas Johansson <jonasj76@gmail.com>
Unit test added. |
@jonasj76 Thanks! :) Yeah I think we should have a global flag, like this:
or something, but I guess it could also be an option flag. I don't have a strong opinion on either one. With a global flag we could let it cascade down on all options on cfg_init() so the code only needs to check |
Signed-off-by: Jonas Johansson <jonasj76@gmail.com>
Added commit to fail when adding a pre-existing section. |
Awesome, thanks! Like we discussed AFK today, adding a global and/or per-setting CFGF_OVERWRITE can be added later. |
Example included.