// ReadBoolDefault tries to parse the specified option as a boolean. If there is
// an error in parsing, the default option is returned.
486727
func (c *Config) ReadBoolDefault(id string, defaultValue bool) bool {
	val, err := c.ReadBool(id)
	if err != nil {
		return defaultValue
	}
	return val
}
20218
func (d *msgpackDecDriver) DecodeBool() (b bool) {
	if !d.bdRead {
		d.readNextBd()
	}
	if d.bd == mpFalse || d.bd == 0 {
		// b = false
	} else if d.bd == mpTrue || d.bd == 1 {
		b = true
	} else {
		d.d.errorf("cannot decode bool: %s: %x/%s", msgBadDesc, d.bd, mpdesc(d.bd))
		return
	}
	d.bdRead = false
	return
}
634705
func ParseBool(val interface{}) (value bool, err error) {
	if val != nil {
		switch v := val.(type) {
		case bool:
			return v, nil
		case string:
			switch v {
			case "1", "t", "T", "true", "TRUE", "True", "YES", "yes", "Yes", "Y", "y", "ON", "on", "On":
				return true, nil
			case "0", "f", "F", "false", "FALSE", "False", "NO", "no", "No", "N", "n", "OFF", "off", "Off":
				return false, nil
			}
		case int8, int32, int64:
			strV := fmt.Sprintf("%s", v)
			if strV == "1" {
				return true, nil
			} else if strV == "0" {
				return false, nil
			}
		case float64:
			if v == 1 {
				return true, nil
			} else if v == 0 {
				return false, nil
			}
		}
		return false, fmt.Errorf("parsing %q: invalid syntax", val)
	}
	return false, fmt.Errorf("parsing <nil>: invalid syntax")
}
369370
func (c *Config) GetBool(key string) (b bool) {
	b, _ = c.GetBoolOk(key)
	return
}
901605
func (c *config) GetBool(key string, args ...interface{}) bool {
	val, err := c.GetBoolErr(key, args...)
	if err != nil {
		c.errorHandler(key, err, args...)
	}
	return val
}
1013496
func optionalBool(arg []bool, defaultValue bool) bool {
	if len(arg) == 0 {
		return defaultValue
	}
	return arg[0]
}
1180280
func (RPCResponse *RPCResponse) GetBool() (bool, error) {
	val, ok := RPCResponse.Result.(bool)
	if !ok {
		return false, fmt.Errorf("could not parse bool from %s", RPCResponse.Result)
	}

	return val, nil
}
715447
func (c *IniConfigContainer) DefaultBool(key string, defaultval bool) bool {
	v, err := c.Bool(key)
	if err != nil {
		return defaultval
	}
	return v
}
641942
func (t *TSMReader) ReadBooleanBlockAt(entry *IndexEntry, vals *[]BooleanValue) ([]BooleanValue, error) {
	t.mu.RLock()
	v, err := t.accessor.readBooleanBlock(entry, vals)
	t.mu.RUnlock()
	return v, err
}
529717
func BoolWithDefault(val *bool, defaultValue bool) bool {
	if val == nil {
		return defaultValue
	}
	return *val
}
578158
func (b *BoolRule) Default() ctypes.ConfigValue {
	if b.default_ != nil {
		return ctypes.ConfigValueBool{Value: *b.default_}
	}
	return nil
}
272585
func AskForBoolFromReaderWithDefaultValue(messageToPrint string, defaultValue bool, inputReader io.Reader) (bool, error) {
	keywordYes := "yes"
	keywordNo := "no"
	if defaultValue == true {
		keywordYes = "YES"
	} else {
		keywordNo = "NO"
	}
	fmt.Printf("%s [%s/%s]: ", messageToPrint, keywordYes, keywordNo)

	scanner := bufio.NewScanner(inputReader)
	scannedText := ""
	if scanner.Scan() {
		scannedText = scanner.Text()
	}
	if err := scanner.Err(); err != nil {
		return false, fmt.Errorf("failed to get input - scanner failed wit error: %s", err)
	}

	if scannedText == "" {
		return defaultValue, nil
	}
	return ParseBool(scannedText)
}
726592
func (reader PluginConfigReaderWithError) GetBool(key string, defaultValue bool) (bool, error) {
	key = reader.config.registerKey(key)
	if reader.HasValue(key) {
		return reader.config.Settings.Bool(key)
	}
	return defaultValue, nil
}
1065505
func decodeBool(rd *bufio.Reader) (string, Bool, error) {
	// name
	name, err := readCstring(rd)
	if err != nil {
		return "", false, err
	}

	// value
	b, err := rd.ReadByte()
	if err != nil {
		return "", false, err
	}
	return name, Bool(b == 0x01), nil
}
903790
func readValue(ctx *cmd.Context, filename string) (string, error) {
	absFilename := ctx.AbsPath(filename)
	fi, err := os.Stat(absFilename)
	if err != nil {
		return "", errors.Errorf("cannot read option from file %q: %v", filename, err)
	}
	if fi.Size() > maxValueSize {
		return "", errors.Errorf("size of option file is larger than 5M")
	}
	content, err := ioutil.ReadFile(ctx.AbsPath(filename))
	if err != nil {
		return "", errors.Errorf("cannot read option from file %q: %v", filename, err)
	}
	return string(content), nil
}
1302036
func ParseBool(value string, defaultValue bool) (bool, error) {
	value = strings.ToLower(strings.Trim(value, " "))
	if value == "" {
		return defaultValue, nil
	}

	return strconv.ParseBool(value)
}
151932
func (reader *PluginConfigReader) GetBool(key string, defaultValue bool) bool {
	value, err := reader.WithError.GetBool(key, defaultValue)
	reader.Errors.Push(err)
	return value
}