Skip to content

Add cascading defaults as an IniDefault option - #59

Merged
QEDK merged 4 commits into
QEDK:masterfrom
crustymonkey:master
Jun 5, 2026
Merged

Add cascading defaults as an IniDefault option#59
QEDK merged 4 commits into
QEDK:masterfrom
crustymonkey:master

Conversation

@crustymonkey

Copy link
Copy Markdown

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. When cascade_defaults is set to true, 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:

[DEFAULT]
fallback_key = fallback value

[mysection]
other_key = other value

With cascade_defaults set to true, a config.get("mysection", "fallback_key") call would return Some("fallback_value") instead of None.

I've added unit tests in the test.rs file to cover the new behavior. I've also attempted to generally follow the same styles used in code/comments.

@crustymonkey

Copy link
Copy Markdown
Author

Ok, looks like the default workflow died due to a lack of cargo fmt. Ran that and pushed a commit for that.

@crustymonkey

Copy link
Copy Markdown
Author

Ok, attempt #2 of cargo fmt with standard max_width

@QEDK

QEDK commented Jun 5, 2026

Copy link
Copy Markdown
Owner

@crustymonkey thanks for your contribution, merged!

@QEDK
QEDK merged commit d541e35 into QEDK:master Jun 5, 2026
3 checks passed
@crustymonkey

Copy link
Copy Markdown
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.

@QEDK

QEDK commented Jun 5, 2026

Copy link
Copy Markdown
Owner

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.

no worries, we appreciate OSS contributions and mistakes naturally happen :)

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.

2 participants