Skip to content

Commit

Permalink
Changes from code review
Browse files Browse the repository at this point in the history
  • Loading branch information
dearchap committed Nov 26, 2022
1 parent b414bd1 commit e2e3aa0
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 19 deletions.
3 changes: 1 addition & 2 deletions flag_slice_impl.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@ func NewSliceBase[T any, C any, VC ValueCreator[T, C]](defaults ...T) *SliceBase
}
}

// TODO: Consistently have specific Set function for Int64 and Float64 ?
// SetInt directly adds an integer to the list of values
// SetOne directly adds a value to the list of values
func (i *SliceBase[T, C, VC]) SetOne(value T) {
if !i.hasBeenSet {
*i.slice = []T{}
Expand Down
2 changes: 1 addition & 1 deletion flag_timestamp.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ func (t *timestampValue) Value() *time.Time {
}

// Get returns the flag structure
func (t *timestampValue) Get() interface{} {
func (t *timestampValue) Get() any {
return *t.timestamp
}

Expand Down
15 changes: 7 additions & 8 deletions godoc-current.txt
Original file line number Diff line number Diff line change
Expand Up @@ -649,10 +649,10 @@ func (cCtx *Context) Timestamp(name string) *time.Time
Timestamp gets the timestamp from a flag name

func (cCtx *Context) Uint(name string) uint
Int looks up the value of a local IntFlag, returns 0 if not found
Uint looks up the value of a local UintFlag, returns 0 if not found

func (cCtx *Context) Uint64(name string) uint64
Int64 looks up the value of a local Int64Flag, returns 0 if not found
Uint64 looks up the value of a local Uint64Flag, returns 0 if not found

func (cCtx *Context) Uint64Slice(name string) []uint64
Uint64Slice looks up the value of a local Uint64SliceFlag, returns nil if
Expand Down Expand Up @@ -966,25 +966,24 @@ func NewSliceBase[T any, C any, VC ValueCreator[T, C]](defaults ...T) *SliceBase
func (i SliceBase[T, C, VC]) Create(val []T, p *[]T, c C) Value

func (i *SliceBase[T, C, VC]) Get() interface{}
Get returns the slice of ints set by this flag
Get returns the slice of values set by this flag

func (i *SliceBase[T, C, VC]) Serialize() string
Serialize allows IntSlice to fulfill Serializer
Serialize allows SliceBase to fulfill Serializer

func (i *SliceBase[T, C, VC]) Set(value string) error
Set parses the value into an integer and appends it to the list of values
Set parses the value and appends it to the list of values

func (i *SliceBase[T, C, VC]) SetOne(value T)
TODO: Consistently have specific Set function for Int64 and Float64 ? SetInt
directly adds an integer to the list of values
SetOne directly adds a value to the list of values

func (i *SliceBase[T, C, VC]) String() string
String returns a readable representation of this value (for usage defaults)

func (i SliceBase[T, C, VC]) ToString(t []T) string

func (i *SliceBase[T, C, VC]) Value() []T
Value returns the slice of ints set by this flag
Value returns the slice of values set by this flag

type StringFlag = FlagBase[string, NoConfig, stringValue]

Expand Down
15 changes: 7 additions & 8 deletions testdata/godoc-v3.x.txt
Original file line number Diff line number Diff line change
Expand Up @@ -649,10 +649,10 @@ func (cCtx *Context) Timestamp(name string) *time.Time
Timestamp gets the timestamp from a flag name

func (cCtx *Context) Uint(name string) uint
Int looks up the value of a local IntFlag, returns 0 if not found
Uint looks up the value of a local UintFlag, returns 0 if not found

func (cCtx *Context) Uint64(name string) uint64
Int64 looks up the value of a local Int64Flag, returns 0 if not found
Uint64 looks up the value of a local Uint64Flag, returns 0 if not found

func (cCtx *Context) Uint64Slice(name string) []uint64
Uint64Slice looks up the value of a local Uint64SliceFlag, returns nil if
Expand Down Expand Up @@ -966,25 +966,24 @@ func NewSliceBase[T any, C any, VC ValueCreator[T, C]](defaults ...T) *SliceBase
func (i SliceBase[T, C, VC]) Create(val []T, p *[]T, c C) Value

func (i *SliceBase[T, C, VC]) Get() interface{}
Get returns the slice of ints set by this flag
Get returns the slice of values set by this flag

func (i *SliceBase[T, C, VC]) Serialize() string
Serialize allows IntSlice to fulfill Serializer
Serialize allows SliceBase to fulfill Serializer

func (i *SliceBase[T, C, VC]) Set(value string) error
Set parses the value into an integer and appends it to the list of values
Set parses the value and appends it to the list of values

func (i *SliceBase[T, C, VC]) SetOne(value T)
TODO: Consistently have specific Set function for Int64 and Float64 ? SetInt
directly adds an integer to the list of values
SetOne directly adds a value to the list of values

func (i *SliceBase[T, C, VC]) String() string
String returns a readable representation of this value (for usage defaults)

func (i SliceBase[T, C, VC]) ToString(t []T) string

func (i *SliceBase[T, C, VC]) Value() []T
Value returns the slice of ints set by this flag
Value returns the slice of values set by this flag

type StringFlag = FlagBase[string, NoConfig, stringValue]

Expand Down

0 comments on commit e2e3aa0

Please sign in to comment.