@@ -19,7 +19,7 @@ export-env {
19
19
def is-env-true [name : string ] {
20
20
if (has-env $name ) {
21
21
# Try to parse 'true', '0', '1', and fail if not convertible
22
- let parsed = do - i { $env | get $name | into bool }
22
+ let parsed = ( do - i { $env | get $name | into bool })
23
23
if ($parsed | describe ) == ' bool' {
24
24
$parsed
25
25
} else {
@@ -34,15 +34,15 @@ export-env {
34
34
let virtual_env = ' __VIRTUAL_ENV__'
35
35
let bin = ' __BIN_NAME__'
36
36
let path_sep = (char esep )
37
- let path_name = if $is_windows {
37
+ let path_name = ( if $is_windows {
38
38
if (has-env ' Path' ) {
39
39
' Path'
40
40
} else {
41
41
' PATH'
42
42
}
43
43
} else {
44
44
' PATH'
45
- }
45
+ })
46
46
47
47
let old_path = (
48
48
if $is_windows {
@@ -69,45 +69,45 @@ export-env {
69
69
VIRTUAL_ENV : $virtual_env
70
70
}
71
71
72
- let new_env = if (is-env-true ' VIRTUAL_ENV_DISABLE_PROMPT' ) {
72
+ let new_env = ( if (is-env-true ' VIRTUAL_ENV_DISABLE_PROMPT' ) {
73
73
$new_env
74
74
} else {
75
75
# Creating the new prompt for the session
76
- let virtual_prompt = if (' __VIRTUAL_PROMPT__' == ' ' ) {
76
+ let virtual_prompt = ( if (' __VIRTUAL_PROMPT__' == ' ' ) {
77
77
$' (char lparen )($virtual_env | path basename )(char rparen ) '
78
78
} else {
79
79
' (__VIRTUAL_PROMPT__) '
80
- }
80
+ })
81
81
82
82
# Back up the old prompt builder
83
- let old_prompt_command = if (has-env ' VIRTUAL_ENV' ) and (has-env ' _OLD_PROMPT_COMMAND' ) {
83
+ let old_prompt_command = ( if (has-env ' VIRTUAL_ENV' ) and (has-env ' _OLD_PROMPT_COMMAND' ) {
84
84
$env ._OLD_PROMPT_COMMAND
85
85
} else {
86
86
if (has-env ' PROMPT_COMMAND' ) {
87
87
$env .PROMPT_COMMAND
88
88
} else {
89
89
' '
90
90
}
91
- }
91
+ })
92
92
93
93
# If there is no default prompt, then only the env is printed in the prompt
94
- let new_prompt = if (has-env ' PROMPT_COMMAND' ) {
94
+ let new_prompt = ( if (has-env ' PROMPT_COMMAND' ) {
95
95
if ' closure' in ($old_prompt_command | describe ) {
96
96
{|| $' ($virtual_prompt )(do $old_prompt_command )' }
97
97
} else {
98
98
{|| $' ($virtual_prompt )($old_prompt_command )' }
99
99
}
100
100
} else {
101
101
{|| $' ($virtual_prompt )' }
102
- }
102
+ })
103
103
104
104
$new_env | merge {
105
105
_OLD_VIRTUAL_PATH : ($old_path | str collect $path_sep )
106
106
_OLD_PROMPT_COMMAND : $old_prompt_command
107
107
PROMPT_COMMAND : $new_prompt
108
108
VIRTUAL_PROMPT : $virtual_prompt
109
109
}
110
- }
110
+ })
111
111
112
112
# Environment variables that will be loaded as the virtual env
113
113
load-env $new_env
0 commit comments