Support multiple key+value pairs for map flags.

This commit is contained in:
Alec Thomas
2018-07-26 20:35:20 +10:00
parent 539214f23e
commit 856d62e28a
3 changed files with 47 additions and 25 deletions
+10
View File
@@ -99,6 +99,16 @@ func TestMapWithNamedTypes(t *testing.T) {
require.Equal(t, map[string]string{"FIRST": "5s", "SECOND": "10s"}, cli.TypedKey)
}
func TestMapWithMultipleValues(t *testing.T) {
var cli struct {
Value map[string]string
}
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:""`