7a5c8dc1eb
* copyright headers for agent folder * Ignore test data files * fix proto files and remove headers in agent/uiserver folder * ignore deep-copy files * copyright headers for agent folder * Copyright headers for command folder * fix merge conflicts
24 lines
476 B
Go
24 lines
476 B
Go
// Copyright (c) HashiCorp, Inc.
|
|
// SPDX-License-Identifier: MPL-2.0
|
|
|
|
package flags
|
|
|
|
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
|
|
}
|