-
Notifications
You must be signed in to change notification settings - Fork 1.7k
/
Copy pathflag_int_slice.go
52 lines (45 loc) · 1.88 KB
/
flag_int_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
package cli
type (
IntSlice = SliceBase[int, IntegerConfig, intValue[int]]
Int8Slice = SliceBase[int8, IntegerConfig, intValue[int8]]
Int16Slice = SliceBase[int16, IntegerConfig, intValue[int16]]
Int32Slice = SliceBase[int32, IntegerConfig, intValue[int32]]
Int64Slice = SliceBase[int64, IntegerConfig, intValue[int64]]
IntSliceFlag = FlagBase[[]int, IntegerConfig, IntSlice]
Int8SliceFlag = FlagBase[[]int8, IntegerConfig, Int8Slice]
Int16SliceFlag = FlagBase[[]int16, IntegerConfig, Int16Slice]
Int32SliceFlag = FlagBase[[]int32, IntegerConfig, Int32Slice]
Int64SliceFlag = FlagBase[[]int64, IntegerConfig, Int64Slice]
)
var (
NewIntSlice = NewSliceBase[int, IntegerConfig, intValue[int]]
NewInt8Slice = NewSliceBase[int8, IntegerConfig, intValue[int8]]
NewInt16Slice = NewSliceBase[int16, IntegerConfig, intValue[int16]]
NewInt32Slice = NewSliceBase[int32, IntegerConfig, intValue[int32]]
NewInt64Slice = NewSliceBase[int64, IntegerConfig, intValue[int64]]
)
// IntSlice looks up the value of a local IntSliceFlag, returns
// nil if not found
func (cmd *Command) IntSlice(name string) []int {
return getNumberSlice[int](cmd, name)
}
// Int8Slice looks up the value of a local Int8SliceFlag, returns
// nil if not found
func (cmd *Command) Int8Slice(name string) []int8 {
return getNumberSlice[int8](cmd, name)
}
// Int16Slice looks up the value of a local Int16SliceFlag, returns
// nil if not found
func (cmd *Command) Int16Slice(name string) []int16 {
return getNumberSlice[int16](cmd, name)
}
// Int32Slice looks up the value of a local Int32SliceFlag, returns
// nil if not found
func (cmd *Command) Int32Slice(name string) []int32 {
return getNumberSlice[int32](cmd, name)
}
// Int64Slice looks up the value of a local Int64SliceFlag, returns
// nil if not found
func (cmd *Command) Int64Slice(name string) []int64 {
return getNumberSlice[int64](cmd, name)
}