Add cascading defaults as an IniDefault option - #59
Merged
Conversation
Author
|
Ok, looks like the default workflow died due to a lack of |
Author
|
Ok, attempt #2 of cargo fmt with standard max_width |
Owner
|
@crustymonkey thanks for your contribution, merged! |
Author
|
Thanks for merging. Sorry about the churn with the formatting. I had forgotten that I made a global max_width change for rustfmt a while back. |
Owner
no worries, we appreciate OSS contributions and mistakes naturally happen :) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This adds an option,
cascade_defaults, that can be set to enable the cascading of values in the[DEFAULT]section to other "concrete" sections. This is NOT enabled by default to preserve backwards compatibility. Whencascade_defaultsis set totrue, this will mimic the behavior of the Python configparser library, wherein the default value will be returned for a section/key lookup that doesn't exist. For example, with this config:With
cascade_defaultsset totrue, aconfig.get("mysection", "fallback_key")call would returnSome("fallback_value")instead ofNone.I've added unit tests in the
test.rsfile to cover the new behavior. I've also attempted to generally follow the same styles used in code/comments.