fix: boolean flag parsing with map.
This commit is contained in:
parent
b55be9fdea
commit
b4c7b90c9e
2 changed files with 39 additions and 4 deletions
|
@ -250,7 +250,7 @@ func TestParse(t *testing.T) {
|
|||
},
|
||||
},
|
||||
{
|
||||
desc: "map struct with sub-map case senstitive",
|
||||
desc: "map struct with sub-map case sensitive",
|
||||
args: []string{"--foo.Name1.bar.name2.value=firstValue", "--foo.naMe1.bar.name2.value=secondValue"},
|
||||
element: &struct {
|
||||
Foo map[string]struct {
|
||||
|
@ -273,6 +273,20 @@ func TestParse(t *testing.T) {
|
|||
"traefik.foo.Name1.bar.name2.value": "secondValue",
|
||||
},
|
||||
},
|
||||
{
|
||||
desc: "pointer of struct and map without explicit value",
|
||||
args: []string{"--foo.default.bar.fuu"},
|
||||
element: &struct {
|
||||
Foo map[string]struct {
|
||||
Bar *struct {
|
||||
Fuu *struct{ Value string }
|
||||
}
|
||||
}
|
||||
}{},
|
||||
expected: map[string]string{
|
||||
"traefik.foo.default.bar.fuu": "true",
|
||||
},
|
||||
},
|
||||
{
|
||||
desc: "slice with several flags 2 and different cases.",
|
||||
args: []string{"--foo", "bar", "--Foo", "baz"},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue