mirror of
https://github.com/JanDeDobbeleer/oh-my-posh.git
synced 2025-01-05 08:17:25 -08:00
fix(shell): split environment variable name and value correctly
This commit is contained in:
parent
9ec794cacf
commit
1a1aecbd36
|
@ -724,13 +724,11 @@ func (env *Shell) TemplateCache() *TemplateCache {
|
||||||
const separator = "="
|
const separator = "="
|
||||||
values := os.Environ()
|
values := os.Environ()
|
||||||
for value := range values {
|
for value := range values {
|
||||||
splitted := strings.Split(values[value], separator)
|
key, val, valid := strings.Cut(values[value], separator)
|
||||||
if len(splitted) != 2 {
|
if !valid {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
key := splitted[0]
|
tmplCache.Env[key] = val
|
||||||
val := splitted[1:]
|
|
||||||
tmplCache.Env[key] = strings.Join(val, separator)
|
|
||||||
}
|
}
|
||||||
pwd := env.Pwd()
|
pwd := env.Pwd()
|
||||||
tmplCache.PWD = ReplaceHomeDirPrefixWithTilde(env, pwd)
|
tmplCache.PWD = ReplaceHomeDirPrefixWithTilde(env, pwd)
|
||||||
|
|
Loading…
Reference in a new issue