mirror of
https://github.com/RGBCube/nu_scripts
synced 2025-08-01 22:57:46 +00:00
conda: Disable prompt via env var instead of flag (#417)
Now that the `alias` command became less powerful, there is no good way to disable the prompt globally anymore. This commit fixes it by using an environment variable `CONDA_NO_PROMPT` instead.
This commit is contained in:
parent
6ec94a84b5
commit
7c28a4f6c3
2 changed files with 4 additions and 5 deletions
|
@ -13,9 +13,9 @@ The activation and deactivation commands are exported from the `conda` module.
|
|||
>
|
||||
```
|
||||
|
||||
Do disable the prompt changes (e.g., to let [Starship](https://starship.rs) include its own), pass a `--no-prompt` flag to `activate`.
|
||||
This can be automated by creating an alias `alias "conda activate" = conda activate --no-prompt` to `$nu.config-path`.
|
||||
The `activate` command includes custom completions for the environment names.
|
||||
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`.
|
||||
|
||||
## Limitations
|
||||
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
# Activate conda environment
|
||||
export def-env activate [
|
||||
env_name?: string@'nu-complete conda envs' # name of the environment
|
||||
--no-prompt # do not update the prompt
|
||||
] {
|
||||
let conda_info = (conda info --envs --json | from json)
|
||||
|
||||
|
@ -36,7 +35,7 @@ export def-env activate [
|
|||
CONDA_OLD_PATH: $old_path
|
||||
} | merge $new_path)
|
||||
|
||||
let new_env = if not $no_prompt {
|
||||
let new_env = if not (has-env CONDA_NO_PROMPT) {
|
||||
let old_prompt_command = if (has-env CONDA_OLD_PROMPT_COMMAND) {
|
||||
$env.CONDA_OLD_PROMPT_COMMAND
|
||||
} else {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue