MCPcopy
hub / github.com/cli/cli / ValidateValue

Function ValidateValue

pkg/cmd/config/set/set.go:108–129  ·  view source on GitHub ↗
(key, value string)

Source from the content-addressed store, hash-verified

106}
107
108func ValidateValue(key, value string) error {
109 var validValues []string
110
111 for _, v := range config.Options {
112 if v.Key == key {
113 validValues = v.AllowedValues
114 break
115 }
116 }
117
118 if validValues == nil {
119 return nil
120 }
121
122 for _, v := range validValues {
123 if v == value {
124 return nil
125 }
126 }
127
128 return InvalidValueError{ValidValues: validValues}
129}

Callers 2

setRunFunction · 0.85
Test_ValidateValueFunction · 0.85

Calls

no outgoing calls

Tested by 1

Test_ValidateValueFunction · 0.68