dotfiles/private_dot_config/nushell/scripts/direnv.nu
Mira Kristipati 7af2a5e131 updates
2024-04-14 20:34:40 -04:00

17 lines
390 B
Text

export-env {
$env.config = ( $env.config | upsert hooks.env_change.PWD { |config|
let o = ($config | get -i hooks.env_change.PWD)
let val = { ||
if (which direnv | is-empty) {
return
}
direnv export json | from json | default {} | load-env
}
if $o == null {
$val
} else {
$o | append $val
}
})
}