2023-03-15 16:00:52 +00:00
|
|
|
// Copyright (c) HashiCorp, Inc.
|
|
|
|
// SPDX-License-Identifier: MPL-2.0
|
|
|
|
|
2015-03-12 22:21:11 +00:00
|
|
|
package sliceflag
|
|
|
|
|
|
|
|
import "strings"
|
|
|
|
|
|
|
|
// StringFlag implements the flag.Value interface and allows multiple
|
|
|
|
// calls to the same variable to append a list.
|
|
|
|
type StringFlag []string
|
|
|
|
|
|
|
|
func (s *StringFlag) String() string {
|
|
|
|
return strings.Join(*s, ",")
|
|
|
|
}
|
|
|
|
|
|
|
|
func (s *StringFlag) Set(value string) error {
|
|
|
|
*s = append(*s, value)
|
|
|
|
return nil
|
|
|
|
}
|