mirror of
https://github.com/hashicorp/packer.git
synced 2026-09-20 15:01:40 -04:00
Co-authored-by: hashicorp-copywrite[bot] <110428419+hashicorp-copywrite[bot]@users.noreply.github.com>
20 lines
431 B
Go
20 lines
431 B
Go
// Copyright (c) HashiCorp, Inc.
|
|
// SPDX-License-Identifier: MPL-2.0
|
|
|
|
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, strings.Split(value, ",")...)
|
|
return nil
|
|
}
|