NewUniqueStringsValue implements string slice as "flag.Value" interface. Given value is to be separated by comma. The values are set in order.
(s string)
| 57 | // Given value is to be separated by comma. |
| 58 | // The values are set in order. |
| 59 | func NewUniqueStringsValue(s string) (us *UniqueStringsValue) { |
| 60 | us = &UniqueStringsValue{Values: make(map[string]struct{})} |
| 61 | if s == "" { |
| 62 | return us |
| 63 | } |
| 64 | if err := us.Set(s); err != nil { |
| 65 | panic(fmt.Sprintf("new UniqueStringsValue should never fail: %v", err)) |
| 66 | } |
| 67 | return us |
| 68 | } |
| 69 | |
| 70 | // UniqueStringsFromFlag returns a string slice from the flag. |
| 71 | func UniqueStringsFromFlag(fs *flag.FlagSet, flagName string) []string { |
searching dependent graphs…