ENH allow zsh-conda to accept init script as arg

This commit is contained in:
Nathan Dwarshuis 2023-05-26 15:27:44 -04:00
parent 8e8723ff64
commit 2d4160b9bd
1 changed files with 13 additions and 5 deletions

View File

@ -449,14 +449,22 @@ zsh-rbenv () {
{{ if .development.conda -}}
zsh-conda () {
if [[ -x $XDG_DATA_HOME/mambaforge/bin/conda ]]; then
if [ -n "$1" ]; then
if [ -f "$1" ]; then
source "$1"
else
echo "Could not source file at $1"
return 1
fi
elif [ -x $XDG_DATA_HOME/mambaforge/bin/conda ]; then
eval "$($XDG_DATA_HOME/mambaforge/bin/conda shell.zsh hook)"
else
echo "conda installation not found"
return 1
fi
alias cdd="conda deactivate"
alias cda="conda activate"
alias cde="conda env"
alias cdl="conda list"
else
echo "conda installation not found"
fi
}
{{- end }}