]> arthur.barton.de Git - ax-zsh.git/blob - core/40_axzsh/40_axzsh.zshrc
axzshctl wrapper: Clean up the environment when disabling AX-ZSH
[ax-zsh.git] / core / 40_axzsh / 40_axzsh.zshrc
1 # AX-ZSH: Alex' Modular ZSH Configuration
2 # 50_axzsh.zshrc: Initialize AX-ZSH
3
4 function axzshctl() {
5         zsh "$AXZSH/bin/axzshctl" "$@" || return $?
6
7         if [[ "$1" = "disable" ]]; then
8                 unset AXZSH AXZSH_FPATH AXZSH_ZLOGIN_READ AXZSH_ZPROFILE_READ
9         fi
10
11         case "$1" in
12                 "disable"*|"enable"*|"reset"*|"set"*|"up"*)
13                         # Command which potentially "changed state".
14                         if [[ -o login ]]; then
15                                 echo "Restarting login shell ..."
16                                 exec -l "$SHELL"
17                         else
18                                 echo "Restarting shell ..."
19                                 exec "$SHELL"
20                         fi
21                         ;;
22         esac
23         return 0
24 }