2018-02-05 16:05:59 -05:00
|
|
|
package opts // import "github.com/docker/docker/runconfig/opts"
|
2014-02-11 23:04:39 -05:00
|
|
|
|
|
|
|
import (
|
2014-04-30 18:46:56 -04:00
|
|
|
"strings"
|
2014-02-11 23:04:39 -05:00
|
|
|
)
|
|
|
|
|
2014-11-14 13:59:14 -05:00
|
|
|
// ConvertKVStringsToMap converts ["key=value"] to {"key":"value"}
|
|
|
|
func ConvertKVStringsToMap(values []string) map[string]string {
|
2015-01-06 19:04:10 -05:00
|
|
|
result := make(map[string]string, len(values))
|
|
|
|
for _, value := range values {
|
|
|
|
kv := strings.SplitN(value, "=", 2)
|
|
|
|
if len(kv) == 1 {
|
|
|
|
result[kv[0]] = ""
|
|
|
|
} else {
|
|
|
|
result[kv[0]] = kv[1]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return result
|
|
|
|
}
|