| 338 | } |
| 339 | |
| 340 | func (c *configFileSettings) IntSlice(name string) ([]int, error) { |
| 341 | if raw, ok := c.Settings[name]; ok { |
| 342 | if slice, ok := raw.([]interface{}); ok { |
| 343 | intSlice := make([]int, len(slice)) |
| 344 | for i, v := range slice { |
| 345 | str, ok := v.(int) |
| 346 | if !ok { |
| 347 | return nil, fmt.Errorf("expected int, found %T for %v ", v, v) |
| 348 | } |
| 349 | intSlice[i] = str |
| 350 | } |
| 351 | return intSlice, nil |
| 352 | } |
| 353 | if v, ok := raw.([]int); ok { |
| 354 | return v, nil |
| 355 | } |
| 356 | return nil, fmt.Errorf("expected int slice found %T for %s", raw, name) |
| 357 | } |
| 358 | return nil, nil |
| 359 | } |
| 360 | |
| 361 | func (c *configFileSettings) Generic(name string) (cli.Generic, error) { |
| 362 | return nil, errors.New("option type Generic not supported") |