From c54b07768c3c5f22aee38748decb8da8b3c15b67 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20=C5=BD=C3=A1dn=C3=ADk?= Date: Tue, 30 Jan 2024 20:19:47 +0200 Subject: [PATCH] Move toolkit environment setting to a command (#67) ## Description Instead of setting the environment on module import, it is now done in a command that needs to be called manually. --- toolkit.nu | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/toolkit.nu b/toolkit.nu index 0e02779..0d15bfe 100644 --- a/toolkit.nu +++ b/toolkit.nu @@ -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?)' }