commit cf34040a150da7cd498268425b59a7d9b0d6788c parent 251edab466e4acbff2470abc26bff69a021d00f8 Author: Alex Balgavy <a.balgavy@gmail.com> Date: Wed, 29 Aug 2018 15:06:28 +0200 conf command can now reload too, adapting to the current shell Diffstat:
M | dotfiles/commonprofile | | | 15 | +++++++++++++-- |
1 file changed, 13 insertions(+), 2 deletions(-)
diff --git a/dotfiles/commonprofile b/dotfiles/commonprofile @@ -70,13 +70,24 @@ conf() { if [ "$1" = 'cd' ]; then cd ~/.cfg || return; elif [ "$1" = 'rc' ]; then - if [[ $0 = *"zsh"* ]]; then + if [[ $SHELL = *"zsh"* ]]; then vim ~/.zshrc - elif [[ $0 = *"bash"* ]]; then + elif [[ $SHELL = *"bash"* ]]; then vim ~/.bashrc fi elif [ "$1" = 'common' ]; then vim ~/.commonprofile + elif [ "$1" = 'reload' ]; then + if [[ $SHELL = *"zsh"* ]]; then + START_TIME=$SECONDS + source ~/.zshrc + echo "Reloaded zsh config ($(( $SECONDS-$START_TIME )) sec)." + elif [[ $SHELL = *"bash"* ]]; then + START_TIME=$SECONDS + source ~/.bashrc + echo "Reloaded bash config ($(( $SECONDS-$START_TIME )) sec)." + fi + else $(command -v git) --git-dir="$HOME"/.cfg/.git --work-tree "$HOME"/.cfg/ "$@" fi