Skip to content

Commit

Permalink
shell: simplify conda() function
Browse files Browse the repository at this point in the history
  • Loading branch information
lightmare committed Apr 22, 2021
1 parent d500c20 commit e018168
Showing 1 changed file with 13 additions and 23 deletions.
36 changes: 13 additions & 23 deletions conda/shell/etc/profile.d/conda.sh
Original file line number Diff line number Diff line change
Expand Up @@ -60,29 +60,19 @@ __conda_reactivate() {
}

conda() {
if [ "$#" -lt 1 ]; then
"$CONDA_EXE" $_CE_M $_CE_CONDA
else
\local cmd="$1"
shift
case "$cmd" in
activate|deactivate)
__conda_activate "$cmd" "$@"
;;
install|update|upgrade|remove|uninstall)
__conda_exe "$cmd" "$@"
\local t1=$?
if [ $t1 = 0 ]; then
__conda_reactivate
else
return $t1
fi
;;
*)
__conda_exe "$cmd" "$@"
;;
esac
fi
\local cmd="${1-__missing__}"
case "$cmd" in
activate|deactivate)
__conda_activate "$@"
;;
install|update|upgrade|remove|uninstall)
__conda_exe "$@" || \return
__conda_reactivate
;;
*)
__conda_exe "$@"
;;
esac
}

if [ -z "${CONDA_SHLVL+x}" ]; then
Expand Down

0 comments on commit e018168

Please sign in to comment.