Skip to content

Commit

Permalink
Move toolkit environment setting to a command (#67)
Browse files Browse the repository at this point in the history
## Description
Instead of setting the environment on module import, it is now done in a
command that needs to be called manually.
  • Loading branch information
kubouch authored Jan 30, 2024
1 parent fcd04e9 commit c54b077
Showing 1 changed file with 15 additions and 11 deletions.
26 changes: 15 additions & 11 deletions toolkit.nu
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
export-env {
$env.NUPM_HOME = ($env.FILE_PWD | path join _nupm_dev)
$env.NUPM_CACHE = ($env.FILE_PWD | path join _nupm_dev cache)
$env.NUPM_TEMP = ($env.FILE_PWD | path join _nupm_dev tmp)
export def --env set-nupm-env [] {
$env.NUPM_HOME = ('./_nupm_dev' | path expand)
$env.NUPM_CACHE = ('./_nupm_dev/cache' | path expand)
$env.NUPM_TEMP = ('./_nupm_dev/tmp' | path expand)

$env.PATH ++= [($env.FILE_PWD | path join _nupm_dev scripts)]
$env.NU_LIB_DIRS ++= [($env.FILE_PWD | path join _nupm_dev modules)]
$env.PATH ++= [('./_nupm_dev/scripts' | path expand)]
$env.NU_LIB_DIRS ++= [('./_nupm_dev/modules' | path expand)]

print $'NUPM_HOME: ($env.NUPM_HOME)'
print $'NUPM_CACHE: ($env.NUPM_CACHE)'
print $'NUPM_TEMP: ($env.NUPM_TEMP)'
print $'PATH: ($env.PATH)'
print $'NU_LIB_DIRS: ($env.NU_LIB_DIRS)'
print-nupm-env
}

export def print-nupm-env [] {
print $'NUPM_HOME: ($env.NUPM_HOME?)'
print $'NUPM_CACHE: ($env.NUPM_CACHE?)'
print $'NUPM_TEMP: ($env.NUPM_TEMP?)'
print $'PATH: ($env.PATH?)'
print $'NU_LIB_DIRS: ($env.NU_LIB_DIRS?)'
}

0 comments on commit c54b077

Please sign in to comment.