Created
May 2, 2019 20:11
-
-
Save lebedov/78e3ff0dd48d893e74ada46753f28979 to your computer and use it in GitHub Desktop.
Bash tab completion of environment names when using conda activate
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Add the following lines to .bashrc to enable tab completion of available conda | |
# environment names when using conda activate. Assumes conda and jq are in one's PATH: | |
export CONDA_ENV_LIST=`conda env list --json | jq -r '[ .envs[1:][] | split("/")[-1] ] | join(" ")'` | |
complete -W "$CONDA_ENV_LIST" conda activate |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment