Last active
May 23, 2016 15:41
-
-
Save mikecharles/aab0eef95599d1cd3eaee611fdf47eb7 to your computer and use it in GitHub Desktop.
Bash completion script for source activating a conda environment
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
| _complete_source_activate_conda() | |
| { | |
| if [ ${COMP_WORDS[COMP_CWORD-1]} != "activate" ] ; then | |
| return 0 | |
| fi | |
| local cur env_list | |
| cur=${COMP_WORDS[COMP_CWORD]} | |
| env_list=$(conda env list | sed '1d;2d;$d' | awk {'print $1'}) | |
| COMPREPLY=( $(compgen -W "${env_list[@]}" -- "$cur") ) | |
| } | |
| complete -F _complete_source_activate_conda source |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment