open-nomad/helper/flag-slice/flag.go

17 lines
338 B
Go
Raw Normal View History

2015-08-23 23:57:54 +00: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 {
*s = append(*s, value)
return nil
}