1package agent 2 3import ( 4 "flag" 5 "strings" 6) 7 8// AppendSliceValue implements the flag.Value interface and allows multiple 9// calls to the same variable to append a list. 10type AppendSliceValue []string 11 12var _ flag.Value = new(AppendSliceValue) 13 14func (s *AppendSliceValue) String() string { 15 return strings.Join(*s, ",") 16} 17 18func (s *AppendSliceValue) Set(value string) error { 19 if *s == nil { 20 *s = make([]string, 0, 1) 21 } 22 23 *s = append(*s, value) 24 return nil 25} 26