MCPcopy Create free account
hub / github.com/cli/cli / ValidateValue

Function ValidateValue

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

Source from the content-addressed store, hash-verified

128}
129
130func ValidateValue(key, value string) error {
131 var validValues []string
132
133 for _, v := range config.Options {
134 if v.Key == key {
135 validValues = v.AllowedValues
136 break
137 }
138 }
139
140 if validValues == nil {
141 return nil
142 }
143
144 if slices.Contains(validValues, value) {
145 return nil
146 }
147
148 return InvalidValueError{ValidValues: validValues}
149}

Callers 2

setRunFunction · 0.85
Test_ValidateValueFunction · 0.85

Calls 1

ContainsMethod · 0.80

Tested by 1

Test_ValidateValueFunction · 0.68