Set sets the value of the opt by parsing the command line value
(value string)
| 302 | |
| 303 | // Set sets the value of the opt by parsing the command line value |
| 304 | func (o *FilterOpt) Set(value string) error { |
| 305 | if value == "" { |
| 306 | return nil |
| 307 | } |
| 308 | if !strings.Contains(value, "=") { |
| 309 | return errors.New("bad format of filter (expected name=value)") |
| 310 | } |
| 311 | name, val, _ := strings.Cut(value, "=") |
| 312 | |
| 313 | // TODO(thaJeztah): these options should not be case-insensitive. |
| 314 | name = strings.ToLower(strings.TrimSpace(name)) |
| 315 | val = strings.TrimSpace(val) |
| 316 | o.filter.Add(name, val) |
| 317 | return nil |
| 318 | } |
| 319 | |
| 320 | // Type returns the option type |
| 321 | func (*FilterOpt) Type() string { |