fix for parent context not setting child flags

This commit is contained in:
Andrew Nicoll 2020-12-09 11:17:21 +00:00
parent d5833134fc
commit 2144cc5ad4
2 changed files with 5 additions and 2 deletions

View File

@ -145,7 +145,10 @@ func (f *Int64SliceFlag) Apply(set *flag.FlagSet) error {
// Int64Slice looks up the value of a local Int64SliceFlag, returns
// nil if not found
func (c *Context) Int64Slice(name string) []int64 {
return lookupInt64Slice(name, c.flagSet)
if fs := lookupFlagSet(name, c); fs != nil {
return lookupInt64Slice(name, fs)
}
return nil
}
func lookupInt64Slice(name string, set *flag.FlagSet) []int64 {

View File

@ -157,7 +157,7 @@ func (f *IntSliceFlag) Apply(set *flag.FlagSet) error {
// nil if not found
func (c *Context) IntSlice(name string) []int {
if fs := lookupFlagSet(name, c); fs != nil {
return lookupIntSlice(name, c.flagSet)
return lookupIntSlice(name, fs)
}
return nil
}