File tree 1 file changed +17
-9
lines changed
1 file changed +17
-9
lines changed Original file line number Diff line number Diff line change @@ -23,17 +23,25 @@ export-env {
23
23
if not (which fnm | is-empty ) {
24
24
fnm-env | load-env
25
25
26
- if (not ($env | default false __fnm_hooked | get __fnm_hooked )) {
27
- $env .__fnm_hooked = true
28
- $env .config = ($env | default {} config ).config
29
- $env .config = ($env .config | default {} hooks )
30
- $env .config = ($env .config | update hooks ($env .config.hooks | default {} env_change ))
31
- $env .config = ($env .config | update hooks.env_change ($env .config.hooks.env_change | default [] PWD ))
32
- $env .config = ($env .config | update hooks.env_change.PWD ($env .config.hooks.env_change.PWD | append { |before , after |
26
+ $env .config = (
27
+ $env .config ?
28
+ | default {}
29
+ | upsert hooks { default {} }
30
+ | upsert hooks.env_change { default {} }
31
+ | upsert hooks.env_change.PWD { default [] }
32
+ )
33
+ let __fnm_hooked = (
34
+ $env .config.hooks.env_change.PWD | any { try { get __fnm_hook } catch { false } }
35
+ )
36
+ if not $__fnm_hooked {
37
+ $env .config.hooks.env_change.PWD = ($env .config.hooks.env_change.PWD | append {
38
+ __fnm_hook : true ,
39
+ code : {|before , after |
33
40
if (' FNM_DIR' in $env ) and ([.nvmrc .node-version ] | path exists | any { |it | $it }) {
34
- (^ fnm use ); (fnm-env | load-env )
41
+ (^ fnm use ); (fnm-env | load-env )
42
+ }
35
43
}
36
- }))
44
+ })
37
45
}
38
46
}
39
47
}
You can’t perform that action at this time.
0 commit comments