MCPcopy
hub / github.com/matryer/xbar / parseBool

Function parseBool

pkg/plugins/item_params.go:277–283  ·  view source on GitHub ↗

parseBool parses a boolean from a string (either `true` or `false`), returning a nice error if it fails.

(s string)

Source from the content-addressed store, hash-verified

275// parseBool parses a boolean from a string (either `true` or `false`),
276// returning a nice error if it fails.
277func parseBool(s string) (bool, error) {
278 b, err := strconv.ParseBool(s)
279 if err != nil {
280 return false, errors.Errorf(`expected "true" or "false", not "%s"`, s)
281 }
282 return b, nil
283}
284
285// parseColor parses the color value given.
286// Valid values: named color, #RGB, #RGBA, #RRGGBB, #RRGGBBAA.

Callers 1

setValueByKeyMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected