mirror of
https://github.com/hashicorp/packer.git
synced 2026-02-03 20:39:29 -05:00
19 lines
433 B
Go
19 lines
433 B
Go
// Copyright IBM Corp. 2013, 2025
|
|
// SPDX-License-Identifier: BUSL-1.1
|
|
|
|
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
|
|
}
|