github.com/thanos-io/thanos@v0.32.5/internal/cortex/util/flagext/stringslice.go (about)

     1  // Copyright (c) The Cortex Authors.
     2  // Licensed under the Apache License 2.0.
     3  
     4  package flagext
     5  
     6  import "fmt"
     7  
     8  // StringSlice is a slice of strings that implements flag.Value
     9  type StringSlice []string
    10  
    11  // String implements flag.Value
    12  func (v StringSlice) String() string {
    13  	return fmt.Sprintf("%s", []string(v))
    14  }
    15  
    16  // Set implements flag.Value
    17  func (v *StringSlice) Set(s string) error {
    18  	*v = append(*v, s)
    19  	return nil
    20  }