Closed erhhung closed 2 years ago
I agree this is confusing, but also most flexible. To do what you want (i.e. only consider a single section for merging) you can:
crudini --get --format=ini new_ini section2 | crudini --merge --output=- old_ini section2
As originally written (and as documented in crudini tests), when you specify a section to merge, then crudini will merge params from all sections to the specified one
Thanks for the "workaround" approach, but I still think the default behavior should be different.
when you specify a section to merge, then crudini will merge params from all sections to the specified one
Even if this is "mechanically" possible based on current behavior, I'm having a hard time thinking of real world use cases where one might actually want to merge params from all sections into a specific one.
An app should, by default, cater to the most common use case with the most logically expected behavior, and use other options or compound "piping workarounds" to support non-standard use cases so that reading documentation isn't a requirement.
Consider these two ini files:
"
old_ini
":"
new_ini
":And running the following
--merge
operation to updatesection2
values from new to old:Why are values from section3—or, rather, the very last set of values from the second file—being used to update values in the specified section: section2?
Expected Behavior
The merge operation should use values only from the specified section, resulting in:
Version: crudini 0.9.3