2015-05-23 19:30:45 -04:00
|
|
|
package sliceflag
|
|
|
|
|
|
|
|
import "strings"
|
|
|
|
|
|
|
|
// StringFlag implements the flag.Value interface and allows multiple
|
|
|
|
// calls to the same variable to append a list.
|
|
|
|
type StringFlag []string
|
|
|
|
|
|
|
|
func (s *StringFlag) String() string {
|
|
|
|
return strings.Join(*s, ",")
|
|
|
|
}
|
|
|
|
|
|
|
|
func (s *StringFlag) Set(value string) error {
|
2015-06-26 20:54:59 -04:00
|
|
|
*s = append(*s, strings.Split(value, ",")...)
|
2015-05-23 19:30:45 -04:00
|
|
|
return nil
|
|
|
|
}
|