update udot (update dot files) function

This commit is contained in:
2016-07-11 23:27:23 +02:00
parent f7d7584e57
commit 90644f07a5

View File

@@ -1,12 +1,33 @@
# Update dotfiles
udot() {
cwd=$(pwd)
cd ~/.dotfiles/
git pull
bin/dfm install
source ~/.dotfiles/aliases
source ~/.dotfiles/functions
cd $cwd
info=$(git --no-pager log --pretty="%h by %an <%ae> on %cd" -1 --abbrev-commit)
local=$(git --no-pager log --pretty="%H" -1)
remote=$(git ls-remote origin | awk "/HEAD/ {print \$1}")
echo -e ""
echo -e ' ____ U ___ u _____ _____ _ U _____ u ____ '
echo -e ' | _"\ \/"_ \/|_ " _| |" ___| ___ |"| \| ___"|// __"| u '
echo -e ' /| | | | | | | | | | U| |_ u |_"_| U | | u | _|" <\___ \/ '
echo -e ' U| |_| |\.-,_| |_| | /| |\ \| _|/ | | \| |/__ | |___ u___) | '
echo -e ' |____/ u \_)-\___/ u |_|U |_| U/| |\u |_____| |_____| |____/>> '
echo -e ' |||_ \\ _// \\_ )(\\,-.-,_|___|_,-.// \\ << >> )( (__)'
echo -e ' (__)_) (__) (__) (__)(__)(_/ \_)-' '-(_/(_")("_)(__) (__)(__) '
echo -e ""
echo -e "$info"
echo -e ""
if [ "$local" = "$remote" ]; then
echo "Already up to date :)"
else
echo -e "Updating..."
cwd=$(pwd)
cd ~/.dotfiles/
git pull
bin/dfm install
source ~/.dotfiles/aliases
source ~/.dotfiles/functions
cd $cwd
fi
echo -e ""
}
# will attach to existing tmux session, create new if one does not exist or just start bash if there is no tmux available.