After rebase

This commit is contained in:
Naveen Gogineni 2022-10-05 22:10:22 -04:00
parent c472192257
commit d724a63144
4 changed files with 32 additions and 37 deletions

View File

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

View File

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

View File

@ -753,6 +753,14 @@ type DocGenerationFlag interface {
DocGenerationFlag is an interface that allows documentation generation for DocGenerationFlag is an interface that allows documentation generation for
the flag 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 { type DurationFlag struct {
Name string Name string
@ -1071,6 +1079,9 @@ func (f *Float64SliceFlag) IsRequired() bool
func (f *Float64SliceFlag) IsSet() bool func (f *Float64SliceFlag) IsSet() bool
IsSet returns whether or not the flag has been set through env or file 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 func (f *Float64SliceFlag) IsVisible() bool
IsVisible returns true if the flag is not hidden, otherwise false 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 func (f *Int64SliceFlag) IsSet() bool
IsSet returns whether or not the flag has been set through env or file 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 func (f *Int64SliceFlag) IsVisible() bool
IsVisible returns true if the flag is not hidden, otherwise false 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 func (f *IntSliceFlag) IsSet() bool
IsSet returns whether or not the flag has been set through env or file 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 func (f *IntSliceFlag) IsVisible() bool
IsVisible returns true if the flag is not hidden, otherwise false 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 func (f *StringSliceFlag) IsSet() bool
IsSet returns whether or not the flag has been set through env or file 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 func (f *StringSliceFlag) IsVisible() bool
IsVisible returns true if the flag is not hidden, otherwise false 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 func (f *Uint64SliceFlag) IsSet() bool
IsSet returns whether or not the flag has been set through env or file 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 func (f *Uint64SliceFlag) IsVisible() bool
IsVisible returns true if the flag is not hidden, otherwise false 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 func (f *UintSliceFlag) IsSet() bool
IsSet returns whether or not the flag has been set through env or file 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 func (f *UintSliceFlag) IsVisible() bool
IsVisible returns true if the flag is not hidden, otherwise false IsVisible returns true if the flag is not hidden, otherwise false

View File

@ -39,11 +39,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"`
DestinationPointer bool `yaml:"destination_pointer"` NoDestinationPointer bool `yaml:"no_destination_pointer"`
} }
type FlagStructField struct { type FlagStructField struct {
@ -77,7 +77,7 @@ func (ft *FlagType) DestinationPointer() bool {
return false return false
} }
return ft.Config.DestinationPointer return ft.Config.NoDestinationPointer
} }
func (ft *FlagType) TypeName() string { func (ft *FlagType) TypeName() string {