a36c5ad81d
interesting. Im almost there
39 lines
1.3 KiB
Bash
Executable File
39 lines
1.3 KiB
Bash
Executable File
|
|
# Use colors, but only if connected to a terminal, and that terminal
|
|
# supports them.
|
|
if which tput >/dev/null 2>&1; then
|
|
ncolors=$(tput colors)
|
|
fi
|
|
if [ -t 1 ] && [ -n "$ncolors" ] && [ "$ncolors" -ge 8 ]; then
|
|
RED="$(tput setaf 1)"
|
|
GREEN="$(tput setaf 2)"
|
|
YELLOW="$(tput setaf 3)"
|
|
BLUE="$(tput setaf 4)"
|
|
BOLD="$(tput bold)"
|
|
NORMAL="$(tput sgr0)"
|
|
else
|
|
RED=""
|
|
GREEN=""
|
|
YELLOW=""
|
|
BLUE=""
|
|
BOLD=""
|
|
NORMAL=""
|
|
fi
|
|
|
|
printf "${BLUE}%s${NORMAL}\n" "Updating your dotfiles"
|
|
cd "$DOTFILES"
|
|
branch=$(git name-rev --name-only HEAD)
|
|
if git pull --rebase --stat origin $branch
|
|
then
|
|
printf '%s' "$GREEN"
|
|
printf '%s\n' ' _____ ______ ______ ______ __ __ ______ ______ '
|
|
printf '%s\n' '/\ __-. /\ __ \ /\__ _\ /\ ___\ /\ \ /\ \ /\ ___\ /\ ___\ '
|
|
printf '%s\n' '\ \ \/\ \ \ \ \/\ \ \/_/\ \/ \ \ __\ \ \ \ \ \ \____ \ \ __\ \ \___ \ '
|
|
printf '%s\n' ' \ \____- \ \_____\ \ \_\ \ \_\ \ \_\ \ \_____\ \ \_____\ \/\_____\ '
|
|
printf '%s\n' ' \/____/ \/_____/ \/_/ \/_/ \/_/ \/_____/ \/_____/ \/_____/ '
|
|
printf "${BLUE}%s\n" "Hooray! Your dotfiles have been updated and/or is at the current version."
|
|
else
|
|
printf "${RED}%s${NORMAL}\n" 'There was an error updating. Try again later?'
|
|
fi
|
|
cd $OLDPWD
|