File tree Expand file tree Collapse file tree 1 file changed +14
-7
lines changed Expand file tree Collapse file tree 1 file changed +14
-7
lines changed Original file line number Diff line number Diff line change @@ -18,13 +18,20 @@ let-env config = {
18
18
hooks: {
19
19
pre_prompt: [{ ||
20
20
let direnv = (direnv export json | from json | default {})
21
- let env_to_convert = ($direnv | transpose key value | where key in $env .ENV_CONVERSIONS)
22
- let converted_values = ($env_to_convert | each {| it|
23
- let convert = ($env .ENV_CONVERSIONS | get $it .key | get from_string)
24
- let value = (do $convert $it .value)
25
- { $it .key: $value }
26
- } | into record)
27
- $direnv | merge $converted_values | load-env
21
+ if ($direnv | is-empty) {
22
+ return
23
+ }
24
+ $direnv
25
+ | items {| key, value|
26
+ {
27
+ key: $key
28
+ value: (if $key in $env .ENV_CONVERSIONS {
29
+ do ($env .ENV_CONVERSIONS | get $key | get from_string) $value
30
+ } else {
31
+ $value
32
+ })
33
+ }
34
+ } | transpose -ird | load-env
28
35
}]
29
36
}
30
37
}
You can’t perform that action at this time.
0 commit comments