Fix:(issue_1197) Set destination field from altsrc for slice flags
This commit is contained in:
parent
1c3ebfab32
commit
d2acd0ed55
@ -109,6 +109,9 @@ func (f *StringSliceFlag) ApplyInputSourceValue(cCtx *cli.Context, isc InputSour
|
||||
continue
|
||||
}
|
||||
underlyingFlag.Value = &sliceValue
|
||||
if f.Destination != nil {
|
||||
f.Destination.Set(sliceValue.Serialize())
|
||||
}
|
||||
}
|
||||
}
|
||||
return nil
|
||||
@ -137,6 +140,9 @@ func (f *IntSliceFlag) ApplyInputSourceValue(cCtx *cli.Context, isc InputSourceC
|
||||
continue
|
||||
}
|
||||
underlyingFlag.Value = &sliceValue
|
||||
if f.Destination != nil {
|
||||
f.Destination.Set(sliceValue.Serialize())
|
||||
}
|
||||
}
|
||||
}
|
||||
return nil
|
||||
|
@ -33,11 +33,9 @@ func NewYamlSourceFromFile(file string) (InputSourceContext, error) {
|
||||
// NewYamlSourceFromFlagFunc creates a new Yaml InputSourceContext from a provided flag name and source context.
|
||||
func NewYamlSourceFromFlagFunc(flagFileName string) func(cCtx *cli.Context) (InputSourceContext, error) {
|
||||
return func(cCtx *cli.Context) (InputSourceContext, error) {
|
||||
if cCtx.IsSet(flagFileName) {
|
||||
filePath := cCtx.String(flagFileName)
|
||||
if filePath := cCtx.String(flagFileName); filePath != "" {
|
||||
return NewYamlSourceFromFile(filePath)
|
||||
}
|
||||
|
||||
return defaultInputSource()
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user