github.com/oNaiPs/go-generate-fast@v0.3.0/src/plugins/go-bindata/AppendSliceValue.go (about)

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