parseBool parses a boolean from a string (either `true` or `false`), returning a nice error if it fails.
(s string)
| 275 | // parseBool parses a boolean from a string (either `true` or `false`), |
| 276 | // returning a nice error if it fails. |
| 277 | func 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. |