This is a refactoring-only change that makes it easier to add a new settings source.
This PR doesn’t change behavior. The util_ArgsMerge
and util_ChainMerge
tests added in #15869 and #15988 were written specifically to confirm that ArgsManager settings are parsed, merged, and returned the same way before and after this change.
This change:
- Makes it easier to add new settings sources that can get merged with existing sources (see 70675c3e4975203ad6222ba2b00c83b4e4213793 from #15935).
- Separates parsing of settings from merging of settings, and deduplicates merging code so it doesn’t happen five different places (GetArg, GetNetBoolArg, GetArgs, IsArgNegated, GetUnsuitableSectionOnlyArgs) in inconsistent ways.
- Documents and tests current strange merging behaviors, so they be cleaned up in the future if resulting code simplifications and UX improvements warrant loss of backwards compatibility. The newly documented behaviors are: command line ignored arguments and more ignored arguments, and config file reverse precedence, inconsistently applied top-level settings, and zombie values.
The original motivation for this change was to make it easy to add a new persistent setting source without introducing more bugs and inconsistencies. Two commits building on top of this to add a persistent -wallet
setting are pretty straightforward and show how the new code can be extended: