Fix: dont generate pointer for dest for Generic flag
This commit is contained in:
parent
0658d61a0e
commit
e13c16bb10
@ -17,7 +17,7 @@ type {{.TypeName}} struct {
|
|||||||
HasBeenSet bool
|
HasBeenSet bool
|
||||||
|
|
||||||
Value {{if .ValuePointer}}*{{end}}{{.GoType}}
|
Value {{if .ValuePointer}}*{{end}}{{.GoType}}
|
||||||
Destination *{{.GoType}}
|
Destination {{if .NoDestinationPointer}}{{else}}*{{end}}{{.GoType}}
|
||||||
|
|
||||||
Aliases []string
|
Aliases []string
|
||||||
EnvVars []string
|
EnvVars []string
|
||||||
|
@ -223,10 +223,11 @@ func (gfs *Spec) SortedFlagTypes() []*FlagType {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type FlagTypeConfig struct {
|
type FlagTypeConfig struct {
|
||||||
SkipInterfaces []string `yaml:"skip_interfaces"`
|
SkipInterfaces []string `yaml:"skip_interfaces"`
|
||||||
StructFields []*FlagStructField `yaml:"struct_fields"`
|
StructFields []*FlagStructField `yaml:"struct_fields"`
|
||||||
TypeName string `yaml:"type_name"`
|
TypeName string `yaml:"type_name"`
|
||||||
ValuePointer bool `yaml:"value_pointer"`
|
ValuePointer bool `yaml:"value_pointer"`
|
||||||
|
NoDestinationPointer bool `yaml:"no_destination_pointer"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type FlagStructField struct {
|
type FlagStructField struct {
|
||||||
@ -256,6 +257,14 @@ func (ft *FlagType) ValuePointer() bool {
|
|||||||
return ft.Config.ValuePointer
|
return ft.Config.ValuePointer
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (ft *FlagType) NoDestinationPointer() bool {
|
||||||
|
if ft.Config == nil {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
return ft.Config.NoDestinationPointer
|
||||||
|
}
|
||||||
|
|
||||||
func (ft *FlagType) TypeName() string {
|
func (ft *FlagType) TypeName() string {
|
||||||
return TypeName(ft.GoType, ft.Config)
|
return TypeName(ft.GoType, ft.Config)
|
||||||
}
|
}
|
||||||
|
@ -6,64 +6,71 @@ flag_types:
|
|||||||
bool:
|
bool:
|
||||||
no_default_text: true
|
no_default_text: true
|
||||||
struct_fields:
|
struct_fields:
|
||||||
- { name: Count, type: int, pointer: true }
|
- name: Count
|
||||||
float64: {}
|
type: int
|
||||||
int64:
|
pointer: true
|
||||||
struct_fields:
|
float64:
|
||||||
- { name: Base, type: int }
|
|
||||||
int:
|
|
||||||
struct_fields:
|
|
||||||
- { name: Base, type: int }
|
|
||||||
time.Duration: {}
|
|
||||||
uint64:
|
|
||||||
struct_fields:
|
|
||||||
- { name: Base, type: int }
|
|
||||||
uint:
|
|
||||||
struct_fields:
|
|
||||||
- { name: Base, type: int }
|
|
||||||
|
|
||||||
string:
|
|
||||||
no_default_text: true
|
|
||||||
struct_fields:
|
|
||||||
- { name: TakesFile, type: bool }
|
|
||||||
Generic:
|
|
||||||
struct_fields:
|
|
||||||
- { name: TakesFile, type: bool }
|
|
||||||
Path:
|
|
||||||
no_default_text: true
|
|
||||||
struct_fields:
|
|
||||||
- { name: TakesFile, type: bool }
|
|
||||||
|
|
||||||
Float64Slice:
|
Float64Slice:
|
||||||
value_pointer: true
|
value_pointer: true
|
||||||
skip_interfaces:
|
skip_interfaces:
|
||||||
- fmt.Stringer
|
- fmt.Stringer
|
||||||
Int64Slice:
|
int:
|
||||||
value_pointer: true
|
struct_fields:
|
||||||
skip_interfaces:
|
- name: Base
|
||||||
- fmt.Stringer
|
type: int
|
||||||
IntSlice:
|
IntSlice:
|
||||||
value_pointer: true
|
value_pointer: true
|
||||||
skip_interfaces:
|
skip_interfaces:
|
||||||
- fmt.Stringer
|
- fmt.Stringer
|
||||||
|
int64:
|
||||||
|
struct_fields:
|
||||||
|
- name: Base
|
||||||
|
type: int
|
||||||
|
Int64Slice:
|
||||||
|
value_pointer: true
|
||||||
|
skip_interfaces:
|
||||||
|
- fmt.Stringer
|
||||||
|
uint:
|
||||||
|
struct_fields:
|
||||||
|
- name: Base
|
||||||
|
type: int
|
||||||
|
UintSlice:
|
||||||
|
value_pointer: true
|
||||||
|
skip_interfaces:
|
||||||
|
- fmt.Stringer
|
||||||
|
uint64:
|
||||||
|
struct_fields:
|
||||||
|
- name: Base
|
||||||
|
type: int
|
||||||
|
Uint64Slice:
|
||||||
|
value_pointer: true
|
||||||
|
skip_interfaces:
|
||||||
|
- fmt.Stringer
|
||||||
|
string:
|
||||||
|
struct_fields:
|
||||||
|
- name: TakesFile
|
||||||
|
type: bool
|
||||||
StringSlice:
|
StringSlice:
|
||||||
value_pointer: true
|
value_pointer: true
|
||||||
skip_interfaces:
|
skip_interfaces:
|
||||||
- fmt.Stringer
|
- fmt.Stringer
|
||||||
struct_fields:
|
struct_fields:
|
||||||
- { name: TakesFile, type: bool }
|
- name: TakesFile
|
||||||
|
type: bool
|
||||||
|
time.Duration:
|
||||||
Timestamp:
|
Timestamp:
|
||||||
value_pointer: true
|
value_pointer: true
|
||||||
struct_fields:
|
struct_fields:
|
||||||
- { name: Layout, type: string }
|
- name: Layout
|
||||||
- { name: Timezone, type: "*time.Location" }
|
type: string
|
||||||
|
- name: Timezone
|
||||||
UintSlice:
|
type: "*time.Location"
|
||||||
value_pointer: true
|
Generic:
|
||||||
skip_interfaces:
|
no_destination_pointer: true
|
||||||
- fmt.Stringer
|
struct_fields:
|
||||||
Uint64Slice:
|
- name: TakesFile
|
||||||
value_pointer: true
|
type: bool
|
||||||
skip_interfaces:
|
Path:
|
||||||
- fmt.Stringer
|
struct_fields:
|
||||||
|
- name: TakesFile
|
||||||
|
type: bool
|
||||||
|
@ -86,7 +86,7 @@ type GenericFlag struct {
|
|||||||
HasBeenSet bool
|
HasBeenSet bool
|
||||||
|
|
||||||
Value Generic
|
Value Generic
|
||||||
Destination *Generic
|
Destination Generic
|
||||||
|
|
||||||
Aliases []string
|
Aliases []string
|
||||||
EnvVars []string
|
EnvVars []string
|
||||||
|
Loading…
x
Reference in New Issue
Block a user