go-flags icon indicating copy to clipboard operation
go-flags copied to clipboard

Add option for key value delimiter

Open anaprimawaty opened this issue 2 years ago • 1 comments

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:"="`
}

anaprimawaty avatar Dec 02 '22 03:12 anaprimawaty

Thank you @anaprimawaty Ana, ability to use = as a delimiter is very much appreciated.

jjkavalam avatar Dec 02 '22 04:12 jjkavalam