Skip to content

Commit

Permalink
Read multiple values
Browse files Browse the repository at this point in the history
  • Loading branch information
hickford committed Mar 26, 2024
1 parent db2202e commit 7e9a284
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,13 @@ func parse(input string) map[string]string {
for _, line := range lines {
parts := strings.SplitN(line, "=", 2)
if len(parts) >= 2 {
pairs[parts[0]] = parts[1]
key, value := parts[0], parts[1]
_, exists := pairs[key]
if strings.HasSuffix(key, "[]") && exists {
pairs[key] += "\n" + value
} else {
pairs[key] = value
}
}
}
return pairs
Expand Down

0 comments on commit 7e9a284

Please sign in to comment.