Open strawhatguy opened 1 year ago
Just want to emphasize that a DefaultProcessor
is created, so users can still call Process
and MustProcess
the same way as before, with the same results. Nothing changes in the parsing logic, which already could handle maps of slices.
Only for those that need the extra behavior would making a custom Processor be necessary. proc.Process
and proc.MustProcess
I believe this preserves the simplicity of the existing code, while allowing others to change it as needed.
Example:
map[string][]int
This wasn't allowed before because the separator for map elements was the same as the separator for slice elements.
Allow custom processors to be configured to handle this, but also preserve the existing behavior. With
proc := NewProcessor().WithMapSepChar(";")
, an envvar set tofoo:1,2,3;bar:4
can be parsed into amap[string][]int
, for exampleThe usage also had to change, as it is no longer just commas. For this, use the actual values of the processor for simplicity.