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