Fix tests per latest main

This commit is contained in:
Naveen Gogineni
2022-08-15 11:41:28 -04:00
committed by Dan Buch
parent 0764ca2295
commit 7097d0eedd
3 changed files with 32 additions and 10 deletions

View File

@@ -99,7 +99,7 @@ func (i *UintSlice) Get() interface{} {
// String returns a readable representation of this value
// (for usage defaults)
func (f *UintSliceFlag) String() string {
return withEnvHint(f.GetEnvVars(), stringifyUintSliceFlag(f))
return withEnvHint(f.GetEnvVars(), f.stringify())
}
// TakesValue returns true of the flag takes a value, otherwise false
@@ -183,6 +183,17 @@ func (f *UintSliceFlag) Get(ctx *Context) []uint {
return ctx.UintSlice(f.Name)
}
func (f *UintSliceFlag) stringify() string {
var defaultVals []string
if f.Value != nil && len(f.Value.Value()) > 0 {
for _, i := range f.Value.Value() {
defaultVals = append(defaultVals, strconv.FormatUint(uint64(i), 10))
}
}
return stringifySliceFlag(f.Usage, f.Names(), defaultVals)
}
// UintSlice looks up the value of a local UintSliceFlag, returns
// nil if not found
func (cCtx *Context) UintSlice(name string) []uint {