Set validates if needed the input value and add it to the internal map, by splitting on '='.
(value string)
| 136 | // Set validates if needed the input value and add it to the |
| 137 | // internal map, by splitting on '='. |
| 138 | func (opts *MapOpts) Set(value string) error { |
| 139 | if opts.validator != nil { |
| 140 | v, err := opts.validator(value) |
| 141 | if err != nil { |
| 142 | return err |
| 143 | } |
| 144 | value = v |
| 145 | } |
| 146 | k, v, _ := strings.Cut(value, "=") |
| 147 | opts.values[k] = v |
| 148 | return nil |
| 149 | } |
| 150 | |
| 151 | // GetAll returns the values of MapOpts as a map. |
| 152 | func (opts *MapOpts) GetAll() map[string]string { |
no outgoing calls