value of a container option (e.g. array) is reset to empty on first specification

This commit is contained in:
2026-03-03 05:58:15 +01:00
parent f55e9cea82
commit ac8d5fa3a9
5 changed files with 19 additions and 11 deletions
+1 -1
View File
@@ -71,7 +71,7 @@ func (opt *cliOptionStringMap) parse(parser cliParser, argIndex int, valuePtr *s
err = errInvalidOptionValue(opt.name, boxedValue, "map of string")
}
} else {
if dict == nil {
if dict == nil || !opt.alreadySeen {
dict = make(map[string]string)
}
for value := range strings.SplitSeq(value, ",") {