File tree 5 files changed +64
-46
lines changed
5 files changed +64
-46
lines changed Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ type {{.TypeName}} struct {
17
17
HasBeenSet bool
18
18
19
19
Value {{if .ValuePointer}}*{{end}}{{.GoType}}
20
- Destination * {{.GoType}}
20
+ Destination {{if .NoDestinationPointer}}{{else}}*{{end}} {{.GoType}}
21
21
22
22
Aliases []string
23
23
EnvVars []string
Original file line number Diff line number Diff line change @@ -223,10 +223,11 @@ func (gfs *Spec) SortedFlagTypes() []*FlagType {
223
223
}
224
224
225
225
type FlagTypeConfig struct {
226
- SkipInterfaces []string `yaml:"skip_interfaces"`
227
- StructFields []* FlagStructField `yaml:"struct_fields"`
228
- TypeName string `yaml:"type_name"`
229
- ValuePointer bool `yaml:"value_pointer"`
226
+ SkipInterfaces []string `yaml:"skip_interfaces"`
227
+ StructFields []* FlagStructField `yaml:"struct_fields"`
228
+ TypeName string `yaml:"type_name"`
229
+ ValuePointer bool `yaml:"value_pointer"`
230
+ NoDestinationPointer bool `yaml:"no_destination_pointer"`
230
231
}
231
232
232
233
type FlagStructField struct {
@@ -256,6 +257,14 @@ func (ft *FlagType) ValuePointer() bool {
256
257
return ft .Config .ValuePointer
257
258
}
258
259
260
+ func (ft * FlagType ) NoDestinationPointer () bool {
261
+ if ft .Config == nil {
262
+ return false
263
+ }
264
+
265
+ return ft .Config .NoDestinationPointer
266
+ }
267
+
259
268
func (ft * FlagType ) TypeName () string {
260
269
return TypeName (ft .GoType , ft .Config )
261
270
}
Original file line number Diff line number Diff line change 5
5
flag_types :
6
6
bool :
7
7
struct_fields :
8
- - { name: Count, type: int, pointer: true }
9
- float64 : {}
10
- int64 :
11
- struct_fields :
12
- - { name: Base, type: int }
13
- int :
14
- struct_fields :
15
- - { name: Base, type: int }
16
- time.Duration : {}
17
- uint64 :
18
- struct_fields :
19
- - { name: Base, type: int }
20
- uint :
21
- struct_fields :
22
- - { name: Base, type: int }
23
-
24
- string :
25
- struct_fields :
26
- - { name: TakesFile, type: bool }
27
- Generic :
28
- struct_fields :
29
- - { name: TakesFile, type: bool }
30
- Path :
31
- struct_fields :
32
- - { name: TakesFile, type: bool }
33
-
8
+ - name : Count
9
+ type : int
10
+ pointer : true
11
+ float64 :
34
12
Float64Slice :
35
13
value_pointer : true
36
14
skip_interfaces :
37
15
- fmt.Stringer
38
- Int64Slice :
39
- value_pointer : true
40
- skip_interfaces :
41
- - fmt.Stringer
16
+ int :
17
+ struct_fields :
18
+ - name : Base
19
+ type : int
42
20
IntSlice :
43
21
value_pointer : true
44
22
skip_interfaces :
45
23
- fmt.Stringer
46
- StringSlice :
24
+ int64 :
25
+ struct_fields :
26
+ - name : Base
27
+ type : int
28
+ Int64Slice :
47
29
value_pointer : true
48
30
skip_interfaces :
49
31
- fmt.Stringer
32
+ uint :
50
33
struct_fields :
51
- - { name: TakesFile, type: bool }
52
- Timestamp :
53
- value_pointer : true
54
- struct_fields :
55
- - { name: Layout, type: string }
56
- - { name: Timezone, type: "*time.Location" }
57
-
34
+ - name : Base
35
+ type : int
58
36
UintSlice :
59
37
value_pointer : true
60
38
skip_interfaces :
61
39
- fmt.Stringer
40
+ uint64 :
41
+ struct_fields :
42
+ - name : Base
43
+ type : int
62
44
Uint64Slice :
45
+ value_pointer : true
46
+ skip_interfaces :
47
+ - fmt.Stringer
48
+ string :
49
+ struct_fields :
50
+ - name : TakesFile
51
+ type : bool
52
+ StringSlice :
63
53
value_pointer : true
64
54
skip_interfaces :
65
55
- fmt.Stringer
66
-
56
+ struct_fields :
57
+ - name : TakesFile
58
+ type : bool
59
+ time.Duration :
60
+ Timestamp :
61
+ value_pointer : true
62
+ struct_fields :
63
+ - name : Layout
64
+ type : string
65
+ - name : Timezone
66
+ type : " *time.Location"
67
+ Generic :
68
+ no_destination_pointer : true
69
+ struct_fields :
70
+ - name : TakesFile
71
+ type : bool
72
+ Path :
73
+ struct_fields :
74
+ - name : TakesFile
75
+ type : bool
Original file line number Diff line number Diff line change @@ -1085,7 +1085,7 @@ type GenericFlag struct {
1085
1085
HasBeenSet bool
1086
1086
1087
1087
Value Generic
1088
- Destination * Generic
1088
+ Destination Generic
1089
1089
1090
1090
Aliases []string
1091
1091
EnvVars []string
Original file line number Diff line number Diff line change @@ -58,7 +58,7 @@ type GenericFlag struct {
58
58
HasBeenSet bool
59
59
60
60
Value Generic
61
- Destination * Generic
61
+ Destination Generic
62
62
63
63
Aliases []string
64
64
EnvVars []string
You can’t perform that action at this time.
0 commit comments