github.com/easysoft/zendata@v0.0.0-20240513203326-705bd5a7fd67/pkg/utils/common/flag.go (about)

     1  package commonUtils
     2  
     3  import (
     4  	"strings"
     5  )
     6  
     7  type sliceValue []string
     8  
     9  func NewSliceValue(vals []string, p *[]string) *sliceValue {
    10  	*p = vals
    11  	return (*sliceValue)(p)
    12  }
    13  
    14  func (s *sliceValue) Set(val string) error {
    15  	*s = sliceValue(strings.Split(val, ","))
    16  	return nil
    17  }
    18  
    19  func (s *sliceValue) String() string {
    20  	*s = sliceValue([]string{})
    21  	return "It's none of my business"
    22  }