Skip to content

Commit 1dc0860

Browse files
committed
Rename path param to field
1 parent 9e520f3 commit 1dc0860

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

stdlib-candidate/set-env.nu

+11-8
Original file line numberDiff line numberDiff line change
@@ -13,22 +13,25 @@
1313
# Add a config hook
1414
# > set-env -a config.hooks.pre_prompt 'ellie | print'
1515
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
1717
value: any # The value to set or append
1818
--append (-a) # Append to the previous value or wrap in a new list
1919
]: 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+
}
2123
let value = if $append {
22-
$env | get or [] $path | append $value
24+
$env | get or [] $field | append $value
2325
} else {
2426
$value
2527
}
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 {
2830
[_] => $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
3134
}
3235
}
33-
load-env { ($path | first): $value }
36+
load-env { ($field | first): $value }
3437
}

0 commit comments

Comments
 (0)