(s string)
| 307 | } |
| 308 | |
| 309 | func ParseBool(s string) (bool, error) { |
| 310 | switch strings.ToLower(s) { |
| 311 | case "1", "true", "on", "yes": |
| 312 | return true, nil |
| 313 | case "0", "false", "off", "no": |
| 314 | return false, nil |
| 315 | } |
| 316 | return false, fmt.Errorf("bool argument should be 'yes' or 'no'") |
| 317 | } |
| 318 | |
| 319 | // Bool maps presence of some configuration directive to a boolean variable. |
| 320 | // Additionally, 'name yes' and 'name no' are mapped to true and false |