-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvalue_duration.go
88 lines (69 loc) · 4.39 KB
/
value_duration.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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
package conf
import "time"
// DurationVar defines a time.Duration flag and environment variable with specified name, default value, and usage string.
// The argument p points to a time.Duration variable in which to store the value of the flag and/or environment variable.
func (c *Configurator) DurationVar(p *time.Duration, name string, value time.Duration, usage string) {
c.env().DurationVar(p, name, value, usage)
c.flag().DurationVar(p, name, value, usage)
}
// Duration defines a time.Duration flag and environment variable with specified name, default value, and usage string.
// The return value is the address of a time.Duration variable that stores the value of the flag and/or environment variable.
func (c *Configurator) Duration(name string, value time.Duration, usage string) *time.Duration {
p := new(time.Duration)
c.DurationVar(p, name, value, usage)
return p
}
// DurationVarE defines a time.Duration environment variable with specified name, default value, and usage string.
// The argument p points to a time.Duration variable in which to store the value of the environment variable.
func (c *Configurator) DurationVarE(p *time.Duration, name string, value time.Duration, usage string) {
c.env().DurationVar(p, name, value, usage)
}
// DurationE defines a time.Duration environment variable with specified name, default value, and usage string.
// The return value is the address of a time.Duration variable that stores the value of the environment variable.
func (c *Configurator) DurationE(name string, value time.Duration, usage string) *time.Duration {
p := new(time.Duration)
c.DurationVarE(p, name, value, usage)
return p
}
// DurationVarF defines a time.Duration flag with specified name, default value, and usage string.
// The argument p points to a time.Duration variable in which to store the value of the flag.
func (c *Configurator) DurationVarF(p *time.Duration, name string, value time.Duration, usage string) {
c.flag().DurationVar(p, name, value, usage)
}
// DurationF defines a time.Duration flag with specified name, default value, and usage string.
// The return value is the address of a time.Duration variable that stores the value of the flag.
func (c *Configurator) DurationF(name string, value time.Duration, usage string) *time.Duration {
p := new(time.Duration)
c.DurationVarF(p, name, value, usage)
return p
}
// DurationVar defines a time.Duration flag and environment variable with specified name, default value, and usage string.
// The argument p points to a time.Duration variable in which to store the value of the flag and/or environment variable.
func DurationVar(p *time.Duration, name string, value time.Duration, usage string) {
Global.DurationVar(p, name, value, usage)
}
// Duration defines a time.Duration flag and environment variable with specified name, default value, and usage string.
// The return value is the address of a time.Duration variable that stores the value of the flag and/or environment variable.
func Duration(name string, value time.Duration, usage string) *time.Duration {
return Global.Duration(name, value, usage)
}
// DurationVarE defines a time.Duration environment variable with specified name, default value, and usage string.
// The argument p points to a time.Duration variable in which to store the value of the environment variable.
func DurationVarE(p *time.Duration, name string, value time.Duration, usage string) {
Global.DurationVarE(p, name, value, usage)
}
// DurationE defines a time.Duration environment variable with specified name, default value, and usage string.
// The return value is the address of a time.Duration variable that stores the value of the environment variable.
func DurationE(name string, value time.Duration, usage string) *time.Duration {
return Global.DurationE(name, value, usage)
}
// DurationVarF defines a time.Duration flag with specified name, default value, and usage string.
// The argument p points to a time.Duration variable in which to store the value of the flag.
func DurationVarF(p *time.Duration, name string, value time.Duration, usage string) {
Global.DurationVarF(p, name, value, usage)
}
// DurationF defines a time.Duration flag with specified name, default value, and usage string.
// The return value is the address of a time.Duration variable that stores the value of the flag.
func DurationF(name string, value time.Duration, usage string) *time.Duration {
return Global.DurationF(name, value, usage)
}