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

use $env. instead of let-env (#543)

related to nushell/nushell#9574

Commands used
```nushell
sd --string-mode "let-env " '$env.' **/*
git rst before_v0.60/
```
This commit is contained in:
Antoine Stevan 2023-07-01 10:40:16 +02:00 committed by GitHub
parent c37fd0449f
commit a61256da0e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
32 changed files with 98 additions and 98 deletions

View file

@ -15,7 +15,7 @@ The activation and deactivation commands are exported from the `conda` module.
The `activate` command also includes custom completions for the environment names.
To disable the prompt changes (e.g., to let [Starship](https://starship.rs) include its own), set the environment variable `CONDA_NO_PROMPT`.
To set it globally, add the line `let-env CONDA_NO_PROMPT = true` to `$nu.config-path`.
To set it globally, add the line `$env.CONDA_NO_PROMPT = true` to `$nu.config-path`.
## Limitations

View file

@ -14,7 +14,7 @@ For example:
# config.nu
export-env {
let-env AUTO_VENV_TRIGGER = '__auto-venv.nu'
$env.AUTO_VENV_TRIGGER = '__auto-venv.nu'
source-env ~/path/to/nu_scripts/modules/virtual_environments/auto-venv/auto-venv.nu
}

View file

@ -8,13 +8,13 @@ export use path_extensions.nu
export-env {
# this needs to be set somewhere
# let-env AUTO_VENV_TRIGGER = '__auto-venv.nu'
# $env.AUTO_VENV_TRIGGER = '__auto-venv.nu'
let hooks = (default-hooks)
let hooks = ($hooks | append (build-hooks))
let-env config = ($env.config | upsert hooks.env_change.PWD $hooks )
$env.config = ($env.config | upsert hooks.env_change.PWD $hooks )
}

View file

@ -75,7 +75,7 @@ export def-env activate [
# Deactivate currently active conda environment
export def-env deactivate [] {
let path_name = if "PATH" in $env { "PATH" } else { "Path" }
let-env $path_name = $env.CONDA_OLD_PATH
$env.$path_name = $env.CONDA_OLD_PATH
hide-env CONDA_PROMPT_MODIFIER
hide-env CONDA_PREFIX
@ -83,7 +83,7 @@ export def-env deactivate [] {
hide-env CONDA_DEFAULT_ENV
hide-env CONDA_OLD_PATH
let-env PROMPT_COMMAND = if $env.CONDA_OLD_PROMPT_COMMAND == $nothing {
$env.PROMPT_COMMAND = if $env.CONDA_OLD_PROMPT_COMMAND == $nothing {
$env.PROMPT_COMMAND
} else {
$env.CONDA_OLD_PROMPT_COMMAND

View file

@ -1,5 +1,5 @@
export-env {
let-env CONDA_BASE_PATH = (if ((sys).host.name == "Windows") {$env.Path} else {$env.PATH})
$env.CONDA_BASE_PATH = (if ((sys).host.name == "Windows") {$env.Path} else {$env.PATH})
let info = (
if not (which mamba | is-empty) {
@ -10,16 +10,16 @@ export-env {
('{"root_prefix": "", "envs": ""}' | from json)
})
let-env CONDA_ROOT = $info.root_prefix
$env.CONDA_ROOT = $info.root_prefix
let-env CONDA_ENVS = ($info.envs | reduce -f {} {|it, acc|
$env.CONDA_ENVS = ($info.envs | reduce -f {} {|it, acc|
if $it == $info.root_prefix {
$acc | upsert "base" $it
} else {
$acc | upsert ($it | path basename) $it
}})
let-env CONDA_CURR = null
$env.CONDA_CURR = null
}
export def-env activate [name: string] {
@ -50,7 +50,7 @@ export def-env deactivate [] {
return
}
let-env CONDA_CURR = null
$env.CONDA_CURR = null
load-env {Path: $env.CONDA_BASE_PATH, PATH: $env.CONDA_BASE_PATH}
}

View file

@ -1,5 +1,5 @@
export-env {
let-env MSVS_BASE_PATH = $env.Path
$env.MSVS_BASE_PATH = $env.Path
let info = (
if not (which vswhere | is-empty) {
@ -9,9 +9,9 @@ export-env {
}
)
let-env MSVS_ROOT = ($info.installationPath.0 | str replace -a '\\' '/')
$env.MSVS_ROOT = ($info.installationPath.0 | str replace -a '\\' '/')
let-env MSVS_MSVC_ROOT = (
$env.MSVS_MSVC_ROOT = (
if not ($"($env.MSVS_ROOT)/VC/Tools/MSVC/" | path exists) {
""
} else if (ls $"($env.MSVS_ROOT)/VC/Tools/MSVC/*" | is-empty) {
@ -20,13 +20,13 @@ export-env {
((ls $"($env.MSVS_ROOT)/VC/Tools/MSVC/*").name.0 | str replace -a '\\' '/')
})
let-env MSVS_MSDK_ROOT = (REG QUERY 'HKLM\SOFTWARE\Wow6432Node\Microsoft\Microsoft SDKs\Windows\v10.0' /v "InstallationFolder" | str replace '(.|\n)+REG_SZ\s+(.+)' "$2")
let-env MSVS_MSDK_ROOT = ($env.MSVS_MSDK_ROOT | str replace -a '\\' '/')
$env.MSVS_MSDK_ROOT = (REG QUERY 'HKLM\SOFTWARE\Wow6432Node\Microsoft\Microsoft SDKs\Windows\v10.0' /v "InstallationFolder" | str replace '(.|\n)+REG_SZ\s+(.+)' "$2")
$env.MSVS_MSDK_ROOT = ($env.MSVS_MSDK_ROOT | str replace -a '\\' '/')
let-env MSVS_MSDK_VER = (REG QUERY 'HKLM\SOFTWARE\Wow6432Node\Microsoft\Microsoft SDKs\Windows\v10.0' /v "ProductVersion" | str replace '(.|\n)+REG_SZ\s+(.+)' "$2")
let-env MSVS_MSDK_VER = $"($env.MSVS_MSDK_VER).0"
$env.MSVS_MSDK_VER = (REG QUERY 'HKLM\SOFTWARE\Wow6432Node\Microsoft\Microsoft SDKs\Windows\v10.0' /v "ProductVersion" | str replace '(.|\n)+REG_SZ\s+(.+)' "$2")
$env.MSVS_MSDK_VER = $"($env.MSVS_MSDK_VER).0"
let-env MSVS_INCLUDE_PATH = ([
$env.MSVS_INCLUDE_PATH = ([
$"($env.MSVS_ROOT)/Include/($env.MSVS_MSDK_VER)/cppwinrt/winrt",
$"($env.MSVS_MSVC_ROOT)/include",
$"($env.MSVS_MSDK_ROOT)Include/($env.MSVS_MSDK_VER)/cppwinrt/winrt",