add support to make map separator configurable

This commit is contained in:
Rene Zbinden
2020-02-14 10:47:58 +01:00
committed by Alec Thomas
parent ca3a30c5f1
commit 529703d8d1
4 changed files with 23 additions and 2 deletions
+10
View File
@@ -161,6 +161,16 @@ func TestMapWithMultipleValues(t *testing.T) {
require.Equal(t, map[string]string{"a": "b", "c": "d"}, cli.Value)
}
func TestMapWithDifferentSeparator(t *testing.T) {
var cli struct {
Value map[string]string `mapsep:","`
}
k := mustNew(t, &cli)
_, err := k.Parse([]string{"--value=a=b,c=d"})
require.NoError(t, err)
require.Equal(t, map[string]string{"a": "b", "c": "d"}, cli.Value)
}
func TestURLMapper(t *testing.T) {
var cli struct {
URL *url.URL `arg:""`