AppendSliceValue.go 506 B

12345678910111213141516171819202122
  1. package bindata
  2. import "strings"
  3. // borrowed from https://github.com/hashicorp/serf/blob/master/command/agent/flag_slice_value.go
  4. // AppendSliceValue implements the flag.Value interface and allows multiple
  5. // calls to the same variable to append a list.
  6. type AppendSliceValue []string
  7. func (s *AppendSliceValue) String() string {
  8. return strings.Join(*s, ",")
  9. }
  10. func (s *AppendSliceValue) Set(value string) error {
  11. if *s == nil {
  12. *s = make([]string, 0, 1)
  13. }
  14. *s = append(*s, value)
  15. return nil
  16. }