go-flags
go-flags copied to clipboard
Add option for key value delimiter
Description
Currently, a map flag only allows :
as the delimiter between key and value, e.g. -f key:value
. This PR allows customisation of the delimiter so users can choose a delimiter that is better suited for their use case. For example, it's more natural to use -e key=value
for a map flag of environment variables.
Users can specify the delimiter via tag options. The default delimiter is :
.
type MyFlag struct {
MyMap map[string]string `short:"f" key-value-delimiter:"="`
}
Thank you @anaprimawaty Ana, ability to use =
as a delimiter is very much appreciated.