mirror of
https://github.com/JanDeDobbeleer/oh-my-posh.git
synced 2024-12-31 13:57:26 -08:00
parent
1899896c6d
commit
c22d0d67be
|
@ -135,8 +135,7 @@ func (p *Python) pyenvVersion() (string, error) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
// Unset whatever loadContext thinks Venv should be
|
// override virtualenv if pyenv set one
|
||||||
p.Venv = ""
|
|
||||||
parts := strings.Split(shortPath, string(filepath.Separator))
|
parts := strings.Split(shortPath, string(filepath.Separator))
|
||||||
if len(parts) > 2 && p.canUseVenvName(parts[2]) {
|
if len(parts) > 2 && p.canUseVenvName(parts[2]) {
|
||||||
p.Venv = parts[2]
|
p.Venv = parts[2]
|
||||||
|
|
|
@ -70,9 +70,9 @@ func TestPythonTemplate(t *testing.T) {
|
||||||
Case: "Pyenv virtual env version name",
|
Case: "Pyenv virtual env version name",
|
||||||
FetchVersion: true,
|
FetchVersion: true,
|
||||||
VirtualEnvName: "demo",
|
VirtualEnvName: "demo",
|
||||||
Expected: "3.8.4",
|
Expected: "demo 3.8.4",
|
||||||
PythonPath: "/home/user/.pyenv/shims/python",
|
PythonPath: "/home/user/.pyenv/shims/python",
|
||||||
Template: "{{ if .Error }}{{ .Error }}{{ else }}{{ .Full }}{{ end }}",
|
Template: "{{ .Venv }} {{ .Full }}",
|
||||||
ResolveSymlink: ResolveSymlink{Path: "/home/user/.pyenv/versions/demo", Err: nil},
|
ResolveSymlink: ResolveSymlink{Path: "/home/user/.pyenv/versions/demo", Err: nil},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue