package types import ( "fmt" ) type Bool bool func (boolean *Bool) Set(value string) (err error) { *boolean, err = ParseBool(value) return } func (value Bool) String() string { if value { return "Yes" } return "No" } func (value Bool) FormatFeatureString() string { if value { return "Enabled" } return "Disabled" } func ParseBool(str string) (Bool, error) { switch str { case "disable", "off": return false, nil case "enable", "on": return true, nil } return false, fmt.Errorf("Faild to parse Boolean: %s\n", str) }