After rebase

main
Naveen Gogineni 2 years ago
parent c472192257
commit d724a63144

@ -17,11 +17,7 @@ type {{.TypeName}} struct {
HasBeenSet bool
Value {{if .ValuePointer}}*{{end}}{{.GoType}}
<<<<<<< HEAD:cmd/urfave-cli-genflags/generated.gotmpl
Destination {{if .NoDestinationPointer}}{{else}}*{{end}}{{.GoType}}
=======
Destination {{if .DestinationPointer}}*{{end}}{{.GoType}}
>>>>>>> Add DestinationPointer for flags generator:internal/genflags/generated.gotmpl
Aliases []string
EnvVars []string

@ -2,7 +2,6 @@
# ./cmd/urfave-cli-genflags/main.go which uses the
# `Spec` type that maps to this file structure.
flag_types:
<<<<<<< HEAD
bool:
struct_fields:
- name: Count
@ -14,30 +13,8 @@ flag_types:
struct_fields:
- name: Action
type: "func(*Context, float64) error"
=======
bool: {}
float64: {}
int64: {}
int: {}
time.Duration: {}
uint64: {}
uint: {}
string:
destination_pointer: true
struct_fields:
- { name: TakesFile, type: bool }
Generic:
struct_fields:
- { name: TakesFile, type: bool }
Path:
destination_pointer: true
struct_fields:
- { name: TakesFile, type: bool }
>>>>>>> Add DestinationPointer for flags generator
Float64Slice:
value_pointer: true
destination_pointer: true
skip_interfaces:
- fmt.Stringer
struct_fields:
@ -64,7 +41,6 @@ flag_types:
type: "func(*Context, int64) error"
Int64Slice:
value_pointer: true
destination_pointer: true
skip_interfaces:
- fmt.Stringer
struct_fields:
@ -78,7 +54,6 @@ flag_types:
type: "func(*Context, uint) error"
UintSlice:
value_pointer: true
destination_pointer: true
skip_interfaces:
- fmt.Stringer
struct_fields:
@ -105,7 +80,6 @@ flag_types:
type: "func(*Context, string) error"
StringSlice:
value_pointer: true
destination_pointer: true
skip_interfaces:
- fmt.Stringer
struct_fields:
@ -119,7 +93,6 @@ flag_types:
type: "func(*Context, time.Duration) error"
Timestamp:
value_pointer: true
destination_pointer: true
struct_fields:
- name: Layout
type: string

@ -753,6 +753,14 @@ type DocGenerationFlag interface {
DocGenerationFlag is an interface that allows documentation generation for
the flag
type DocGenerationSliceFlag interface {
DocGenerationFlag
// IsSliceFlag returns true for flags that can be given multiple times.
IsSliceFlag() bool
}
DocGenerationSliceFlag extends DocGenerationFlag for slice-based flags.
type DurationFlag struct {
Name string
@ -1071,6 +1079,9 @@ func (f *Float64SliceFlag) IsRequired() bool
func (f *Float64SliceFlag) IsSet() bool
IsSet returns whether or not the flag has been set through env or file
func (f *Float64SliceFlag) IsSliceFlag() bool
IsSliceFlag implements DocGenerationSliceFlag.
func (f *Float64SliceFlag) IsVisible() bool
IsVisible returns true if the flag is not hidden, otherwise false
@ -1306,6 +1317,9 @@ func (f *Int64SliceFlag) IsRequired() bool
func (f *Int64SliceFlag) IsSet() bool
IsSet returns whether or not the flag has been set through env or file
func (f *Int64SliceFlag) IsSliceFlag() bool
IsSliceFlag implements DocGenerationSliceFlag.
func (f *Int64SliceFlag) IsVisible() bool
IsVisible returns true if the flag is not hidden, otherwise false
@ -1471,6 +1485,9 @@ func (f *IntSliceFlag) IsRequired() bool
func (f *IntSliceFlag) IsSet() bool
IsSet returns whether or not the flag has been set through env or file
func (f *IntSliceFlag) IsSliceFlag() bool
IsSliceFlag implements DocGenerationSliceFlag.
func (f *IntSliceFlag) IsVisible() bool
IsVisible returns true if the flag is not hidden, otherwise false
@ -1810,6 +1827,9 @@ func (f *StringSliceFlag) IsRequired() bool
func (f *StringSliceFlag) IsSet() bool
IsSet returns whether or not the flag has been set through env or file
func (f *StringSliceFlag) IsSliceFlag() bool
IsSliceFlag implements DocGenerationSliceFlag.
func (f *StringSliceFlag) IsVisible() bool
IsVisible returns true if the flag is not hidden, otherwise false
@ -2071,6 +2091,9 @@ func (f *Uint64SliceFlag) IsRequired() bool
func (f *Uint64SliceFlag) IsSet() bool
IsSet returns whether or not the flag has been set through env or file
func (f *Uint64SliceFlag) IsSliceFlag() bool
IsSliceFlag implements DocGenerationSliceFlag.
func (f *Uint64SliceFlag) IsVisible() bool
IsVisible returns true if the flag is not hidden, otherwise false
@ -2227,6 +2250,9 @@ func (f *UintSliceFlag) IsRequired() bool
func (f *UintSliceFlag) IsSet() bool
IsSet returns whether or not the flag has been set through env or file
func (f *UintSliceFlag) IsSliceFlag() bool
IsSliceFlag implements DocGenerationSliceFlag.
func (f *UintSliceFlag) IsVisible() bool
IsVisible returns true if the flag is not hidden, otherwise false

@ -39,11 +39,11 @@ func (gfs *Spec) SortedFlagTypes() []*FlagType {
}
type FlagTypeConfig struct {
SkipInterfaces []string `yaml:"skip_interfaces"`
StructFields []*FlagStructField `yaml:"struct_fields"`
TypeName string `yaml:"type_name"`
ValuePointer bool `yaml:"value_pointer"`
DestinationPointer bool `yaml:"destination_pointer"`
SkipInterfaces []string `yaml:"skip_interfaces"`
StructFields []*FlagStructField `yaml:"struct_fields"`
TypeName string `yaml:"type_name"`
ValuePointer bool `yaml:"value_pointer"`
NoDestinationPointer bool `yaml:"no_destination_pointer"`
}
type FlagStructField struct {
@ -77,7 +77,7 @@ func (ft *FlagType) DestinationPointer() bool {
return false
}
return ft.Config.DestinationPointer
return ft.Config.NoDestinationPointer
}
func (ft *FlagType) TypeName() string {

Loading…
Cancel
Save