value of a container option (e.g. array) is reset to empty on first specification
This commit is contained in:
@@ -76,6 +76,10 @@ func (opt *cliOptionIntArray) parse(parser cliParser, argIndex int, valuePtr *st
|
||||
err = errInvalidOptionValue(opt.name, boxedValue, "num-array")
|
||||
}
|
||||
} else {
|
||||
if !opt.alreadySeen {
|
||||
*opt.targetVar = []int{}
|
||||
opt.alreadySeen = true
|
||||
}
|
||||
for value := range strings.SplitSeq(optValue, ",") {
|
||||
var minRange, maxRange int
|
||||
if minRange, maxRange, err = parseIntRange(value); err == nil {
|
||||
|
||||
Reference in New Issue
Block a user