MCPcopy
hub / github.com/1Password/for-open-source / boolSection

Method boolSection

script/application.go:273–288  ·  view source on GitHub ↗
(sectionName string, required bool, callbacks ...ValidatorCallback)

Source from the content-addressed store, hash-verified

271}
272
273func (a *Application) boolSection(sectionName string, required bool, callbacks ...ValidatorCallback) bool {
274 value := a.stringSection(sectionName, required, callbacks...)
275
276 // Don't bother proceeding if there's already an error parsing the string
277 if a.validator.HasError(sectionName) || value == "" {
278 return false
279 }
280
281 pass, boolean, message := ParseBool(value)
282 if !pass {
283 a.validator.AddError(sectionName, fmt.Sprintf("%t", boolean), message)
284 return false
285 }
286
287 return boolean
288}

Callers 1

ParseMethod · 0.95

Calls 4

stringSectionMethod · 0.95
ParseBoolFunction · 0.85
HasErrorMethod · 0.80
AddErrorMethod · 0.80

Tested by

no test coverage detected