File tree 1 file changed +11
-8
lines changed
1 file changed +11
-8
lines changed Original file line number Diff line number Diff line change 13
13
# Add a config hook
14
14
# > set-env -a config.hooks.pre_prompt 'ellie | print'
15
15
export def --env main [
16
- path : cell -path # The environment variable name or nested option path
16
+ field : cell -path # The environment variable name or nested option cell path
17
17
value : any # The value to set or append
18
18
-- append (- a ) # Append to the previous value or wrap in a new list
19
19
]: nothing -> nothing {
20
- def 'get or' [default path ] { get -- ignore-errors $path | default $default }
20
+ def 'get or' [default field ] {
21
+ get -- ignore-errors $field | default $default
22
+ }
21
23
let value = if $append {
22
- $env | get or [] $path | append $value
24
+ $env | get or [] $field | append $value
23
25
} else {
24
26
$value
25
27
}
26
- let path = $path | to text | split row .
27
- let value = match $path {
28
+ let field = $field | to text | split row .
29
+ let value = match $field {
28
30
[_ ] => $value
29
- [$root , .. $path ] => {
30
- $env | get or {} $root | upsert ($path | into cell-path ) $value
31
+ [$root , .. $field ] => {
32
+ let field = $field | into cell-path
33
+ $env | get or {} $root | upsert $field $value
31
34
}
32
35
}
33
- load-env { ($path | first ): $value }
36
+ load-env { ($field | first ): $value }
34
37
}
You can’t perform that action at this time.
0 commit comments