-
Notifications
You must be signed in to change notification settings - Fork 0
/
value_bool.gen.go
51 lines (36 loc) · 1.63 KB
/
value_bool.gen.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
package env
import "strconv"
type boolValue bool
func newBoolValue(val bool, p *bool) *boolValue {
*p = val
return (*boolValue)(p)
}
func (b *boolValue) Set(val string) error {
v, err := strconv.ParseBool(val)
*b = boolValue(v)
return err
}
func (*boolValue) Type() string { return "bool" }
func (b *boolValue) String() string { return strconv.FormatBool(bool(*b)) }
// BoolVar defines a bool environment variable with specified name, default value, and usage string.
// The argument p points to a bool variable in which to store the value of the environment variable.
func (s *EnvVarSet) BoolVar(p *bool, name string, value bool, usage string) {
s.Var(newBoolValue(value, p), name, usage)
}
// Bool defines a bool environment variable with specified name, default value, and usage string.
// The return value is the address of a bool variable that stores the value of the environment variable.
func (s *EnvVarSet) Bool(name string, value bool, usage string) *bool {
p := new(bool)
s.BoolVar(p, name, value, usage)
return p
}
// BoolVar defines a bool environment variable with specified name, default value, and usage string.
// The argument p points to a bool variable in which to store the value of the environment variable.
func BoolVar(p *bool, name string, value bool, usage string) {
Environment.BoolVar(p, name, value, usage)
}
// Bool defines a bool environment variable with specified name, default value, and usage string.
// The return value is the address of a bool variable that stores the value of the environment variable.
func Bool(name string, value bool, usage string) *bool {
return Environment.Bool(name, value, usage)
}