-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Open
Labels
area/v3relates to / is being considered for v3relates to / is being considered for v3kind/questionsomeone asking a questionsomeone asking a questionstatus/triagemaintainers still need to look into thismaintainers still need to look into this
Description
My question is how to set up a string map of a string slice.
Input: --cidrs "dev=10.0.0.0/8,192.168.1.1/32" --ip-list "prod=10.1.0.0/8"
Currently configured like this:
&cli.StringMapFlag{
Name: "cidrs",
Value: map[string]string{},
Validator: func(m map[string]string) error {
for _, value := range m {
cidrs := strings.Split(value, ",")
if len(cidrs) < 1 {
return fmt.Errorf("expected at least on cidr")
}
for _, cidr := range cidrs {
_, _, err := net.ParseCIDR(cidr)
if err != nil {
return fmt.Errorf("%w, parsing at least one of the entered CIDR was unsuccessful, expect format per CIDR of '<IP>/<suffix>'", err)
}
}
}
return nil
},
},
This results now in this error: Incorrect Usage: invalid value "dev=10.0.0.0/8,192.168.1.1/32" for flag -cidrs: item "192.168.1.1/32" is missing separator "="
Metadata
Metadata
Assignees
Labels
area/v3relates to / is being considered for v3relates to / is being considered for v3kind/questionsomeone asking a questionsomeone asking a questionstatus/triagemaintainers still need to look into thismaintainers still need to look into this