github.com/marksheahan/packer@v0.10.2-0.20160613200515-1acb2d6645a0/helper/flag-slice/flag.go (about)

     1  package sliceflag
     2  
     3  import "strings"
     4  
     5  // StringFlag implements the flag.Value interface and allows multiple
     6  // calls to the same variable to append a list.
     7  type StringFlag []string
     8  
     9  func (s *StringFlag) String() string {
    10  	return strings.Join(*s, ",")
    11  }
    12  
    13  func (s *StringFlag) Set(value string) error {
    14  	*s = append(*s, strings.Split(value, ",")...)
    15  	return nil
    16  }