IsSetBool returns the value of the boolean flag if it is set. It returns false if the flag isn't set or if any error occurs attempting to parse the value of the flag.
(cmd *cobra.Command, name string)
| 24 | // It returns false if the flag isn't set or if any error occurs attempting |
| 25 | // to parse the value of the flag. |
| 26 | func IsSetBool(cmd *cobra.Command, name string) bool { |
| 27 | val, ok := IsSet(cmd, name) |
| 28 | if !ok { |
| 29 | return false |
| 30 | } |
| 31 | |
| 32 | b, err := strconv.ParseBool(val) |
| 33 | return err == nil && b |
| 34 | } |
| 35 | |
| 36 | // IsSet returns the string value of the flag and whether it was set. |
| 37 | func IsSet(cmd *cobra.Command, name string) (string, bool) { |