-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvalue_string_slice.go
138 lines (120 loc) · 5.58 KB
/
value_string_slice.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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
package conf
// StringSliceVar defines a string flag and environment variable with specified name, default value, and usage string.
// The argument p points to a []string variable in which to store the value of the flag and/or environment variable.
// For example:
// --string-slice="v1,v2" --string-slice="v3"
// STRING_SLICE="v1,v2,v3"
// will result in
// []string{"v1", "v2", "v3"}
func (c *Configurator) StringSliceVar(p *[]string, name string, value []string, usage string) {
c.env().StringSliceVar(p, name, value, usage)
c.flag().StringSliceVar(p, name, value, usage)
}
// StringSlice defines a string flag and environment variable with specified name, default value, and usage string.
// The return value is the address of a []string variable that stores the value of the flag and/or environment variable.
// For example:
// --string-slice="v1,v2" --string-slice="v3"
// STRING_SLICE="v1,v2,v3"
// will result in
// []string{"v1", "v2", "v3"}
func (c *Configurator) StringSlice(name string, value []string, usage string) *[]string {
p := new([]string)
c.StringSliceVar(p, name, value, usage)
return p
}
// StringSliceVarE defines a string environment variable with specified name, default value, and usage string.
// The argument p points to a []string variable in which to store the value of the environment variable.
// For example:
// STRING_SLICE="v1,v2,v3"
// will result in
// []string{"v1", "v2", "v3"}
func (c *Configurator) StringSliceVarE(p *[]string, name string, value []string, usage string) {
c.env().StringSliceVar(p, name, value, usage)
}
// StringSliceE defines a string environment variable with specified name, default value, and usage string.
// The return value is the address of a []string variable that stores the value of the environment variable.
// For example:
// STRING_SLICE="v1,v2,v3"
// will result in
// []string{"v1", "v2", "v3"}
func (c *Configurator) StringSliceE(name string, value []string, usage string) *[]string {
p := new([]string)
c.StringSliceVarE(p, name, value, usage)
return p
}
// StringSliceVarF defines a string flag with specified name, default value, and usage string.
// The argument p points to a []string variable in which to store the value of the flag.
// For example:
// --string-slice="v1,v2" --string-slice="v3"
// will result in
// []string{"v1", "v2", "v3"}
func (c *Configurator) StringSliceVarF(p *[]string, name string, value []string, usage string) {
c.flag().StringSliceVar(p, name, value, usage)
}
// StringSliceF defines a string flag with specified name, default value, and usage string.
// The return value is the address of a []string variable that stores the value of the flag.
// For example:
// --string-slice="v1,v2" --string-slice="v3"
// will result in
// []string{"v1", "v2", "v3"}
func (c *Configurator) StringSliceF(name string, value []string, usage string) *[]string {
p := new([]string)
c.StringSliceVarF(p, name, value, usage)
return p
}
// StringSliceVar defines a string flag and environment variable with specified name, default value, and usage string.
// The argument p points to a []string variable in which to store the value of the flag and/or environment variable.
// For example:
// --string-slice="v1,v2" --string-slice="v3"
// STRING_SLICE="v1,v2,v3"
// will result in
// []string{"v1", "v2", "v3"}
func StringSliceVar(p *[]string, name string, value []string, usage string) {
Global.StringSliceVar(p, name, value, usage)
}
// StringSlice defines a string flag and environment variable with specified name, default value, and usage string.
// The return value is the address of a []string variable that stores the value of the flag and/or environment variable.
// For example:
// --string-slice="v1,v2" --string-slice="v3"
// STRING_SLICE="v1,v2,v3"
// will result in
// []string{"v1", "v2", "v3"}
func StringSlice(name string, value []string, usage string) *[]string {
return Global.StringSlice(name, value, usage)
}
// StringSliceVarE defines a string environment variable with specified name, default value, and usage string.
// The argument p points to a []string variable in which to store the value of the environment variable.
// For example:
// STRING_SLICE="v1,v2,v3"
// will result in
// []string{"v1", "v2", "v3"}
func StringSliceVarE(p *[]string, name string, value []string, usage string) {
Global.StringSliceVarE(p, name, value, usage)
}
// StringSliceE defines a string environment variable with specified name, default value, and usage string.
// The return value is the address of a []string variable that stores the value of the environment variable.
// For example:
// STRING_SLICE="v1,v2,v3"
// will result in
// []string{"v1", "v2", "v3"}
func StringSliceE(name string, value []string, usage string) *[]string {
return Global.StringSliceE(name, value, usage)
}
// StringSliceVarF defines a string flag with specified name, default value, and usage string.
// The argument p points to a []string variable in which to store the value of the flag.
// For example:
// --string-slice="v1,v2" --string-slice="v3"
// will result in
// []string{"v1", "v2", "v3"}
func StringSliceVarF(p *[]string, name string, value []string, usage string) {
Global.StringSliceVarF(p, name, value, usage)
}
// StringSliceF defines a string flag with specified name, default value, and usage string.
// The return value is the address of a []string variable that stores the value of the flag.
// For example:
// --string-slice="v1,v2" --string-slice="v3"
// will result in
// []string{"v1", "v2", "v3"}
func StringSliceF(name string, value []string, usage string) *[]string {
return Global.StringSliceF(name, value, usage)
}