1
Fork 0
mirror of https://github.com/RGBCube/nu_scripts synced 2025-08-01 06:37:46 +00:00

Update python-venv.nu so we can enter subdirectory without an error (#574)

This commit is contained in:
WindSoilder 2023-08-15 03:00:52 +08:00 committed by GitHub
parent e60d20733e
commit dd499c916f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -84,12 +84,19 @@ export def-env auto-venv-on-enter [
$'($virtual_prompt)'
}
# Add current PWD to NU_LIB_DIRS so we can enter sub-directory without an error
let new_lib_dirs = if not $env.PWD in $env.NU_LIB_DIRS {
$env.NU_LIB_DIRS | prepend $env.PWD
} else {
$env.NU_LIB_DIRS
}
# Environment variables that will be batched loaded to the virtual env
let new_env = {
$path_name : $new_path
VIRTUAL_ENV : $virtual_env
PROMPT_COMMAND : $new_prompt
VIRTUAL_PROMPT : $virtual_prompt
NU_LIB_DIRS : $new_lib_dirs
}
# Activate the environment variables