2023-03-28 19:12:30 +00:00
|
|
|
// Copyright (c) HashiCorp, Inc.
|
2023-08-11 13:12:13 +00:00
|
|
|
// SPDX-License-Identifier: BUSL-1.1
|
2023-03-28 19:12:30 +00:00
|
|
|
|
2017-10-11 12:51:19 +00:00
|
|
|
package flags
|
2013-12-21 00:39:32 +00:00
|
|
|
|
|
|
|
import "strings"
|
|
|
|
|
|
|
|
// AppendSliceValue implements the flag.Value interface and allows multiple
|
|
|
|
// calls to the same variable to append a list.
|
|
|
|
type AppendSliceValue []string
|
|
|
|
|
|
|
|
func (s *AppendSliceValue) String() string {
|
|
|
|
return strings.Join(*s, ",")
|
|
|
|
}
|
|
|
|
|
|
|
|
func (s *AppendSliceValue) Set(value string) error {
|
|
|
|
if *s == nil {
|
|
|
|
*s = make([]string, 0, 1)
|
|
|
|
}
|
|
|
|
|
|
|
|
*s = append(*s, value)
|
|
|
|
return nil
|
|
|
|
}
|