1
0
mirror of https://github.com/rancher/os.git synced 2025-09-01 14:48:55 +00:00

rancherctl env subcommand

Usage:
rancherctl env <command>

Executes <command> with environment from rancher.environment. Real env vars override those from rancher.environment.
This commit is contained in:
Ivan Mikushin
2015-04-29 15:32:12 +05:00
parent 6f4d7a177a
commit d62eb3de5d
3 changed files with 65 additions and 0 deletions

View File

@@ -302,3 +302,21 @@ func GetValue(kvPairs []string, key string) string {
return ""
}
func Map2KVPairs(m map[string]string) []string {
r := make([]string, 0, len(m))
for k, v := range m {
r = append(r, k + "=" + v)
}
return r
}
func KVPairs2Map(kvs []string) map[string]string {
r := make(map[string]string, len(kvs))
for _, kv := range kvs {
sepIdx := strings.Index(kv, "=")
k, v := kv[:sepIdx], kv[(sepIdx + 1):]
r[k] = v
}
return r
}