mirror of
https://github.com/ceph/ceph-csi.git
synced 2025-06-13 10:33:35 +00:00
rebase: update kubernetes to latest
updating the kubernetes release to the latest in main go.mod Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
This commit is contained in:
committed by
mergify[bot]
parent
63c4c05b35
commit
5a66991bb3
24
vendor/k8s.io/component-base/cli/flag/colon_separated_multimap_string_string.go
generated
vendored
24
vendor/k8s.io/component-base/cli/flag/colon_separated_multimap_string_string.go
generated
vendored
@ -33,8 +33,9 @@ import (
|
||||
// while still allowing the distribution of key-value pairs across multiple flag invocations.
|
||||
// For example: `--flag "a:hello" --flag "b:again" --flag "b:beautiful" --flag "c:world"` results in `{"a": ["hello"], "b": ["again", "beautiful"], "c": ["world"]}`
|
||||
type ColonSeparatedMultimapStringString struct {
|
||||
Multimap *map[string][]string
|
||||
initialized bool // set to true after the first Set call
|
||||
Multimap *map[string][]string
|
||||
initialized bool // set to true after the first Set call
|
||||
allowDefaultEmptyKey bool
|
||||
}
|
||||
|
||||
// NewColonSeparatedMultimapStringString takes a pointer to a map[string][]string and returns the
|
||||
@ -43,6 +44,12 @@ func NewColonSeparatedMultimapStringString(m *map[string][]string) *ColonSeparat
|
||||
return &ColonSeparatedMultimapStringString{Multimap: m}
|
||||
}
|
||||
|
||||
// NewColonSeparatedMultimapStringStringAllowDefaultEmptyKey takes a pointer to a map[string][]string and returns the
|
||||
// ColonSeparatedMultimapStringString flag parsing shim for that map. It allows default empty key with no colon in the flag.
|
||||
func NewColonSeparatedMultimapStringStringAllowDefaultEmptyKey(m *map[string][]string) *ColonSeparatedMultimapStringString {
|
||||
return &ColonSeparatedMultimapStringString{Multimap: m, allowDefaultEmptyKey: true}
|
||||
}
|
||||
|
||||
// Set implements github.com/spf13/pflag.Value
|
||||
func (m *ColonSeparatedMultimapStringString) Set(value string) error {
|
||||
if m.Multimap == nil {
|
||||
@ -58,11 +65,16 @@ func (m *ColonSeparatedMultimapStringString) Set(value string) error {
|
||||
continue
|
||||
}
|
||||
kv := strings.SplitN(pair, ":", 2)
|
||||
if len(kv) != 2 {
|
||||
return fmt.Errorf("malformed pair, expect string:string")
|
||||
var k, v string
|
||||
if m.allowDefaultEmptyKey && len(kv) == 1 {
|
||||
v = strings.TrimSpace(kv[0])
|
||||
} else {
|
||||
if len(kv) != 2 {
|
||||
return fmt.Errorf("malformed pair, expect string:string")
|
||||
}
|
||||
k = strings.TrimSpace(kv[0])
|
||||
v = strings.TrimSpace(kv[1])
|
||||
}
|
||||
k := strings.TrimSpace(kv[0])
|
||||
v := strings.TrimSpace(kv[1])
|
||||
(*m.Multimap)[k] = append((*m.Multimap)[k], v)
|
||||
}
|
||||
return nil
|
||||
|
Reference in New Issue
Block a user