MCPcopy Create free account
hub / github.com/coder/envbox / IsSetBool

Function IsSetBool

cli/cliflag/cliflag.go:26–34  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

24// It returns false if the flag isn't set or if any error occurs attempting
25// to parse the value of the flag.
26func 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.
37func IsSet(cmd *cobra.Command, name string) (string, bool) {

Callers

nothing calls this directly

Calls 1

IsSetFunction · 0.85

Tested by

no test coverage detected