Last active
March 20, 2021 10:49
-
-
Save podanypepa/012a27752adfa71ae46ce32a342d7836 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Bold | |
BBlack='\033[1;30m' # Black | |
BRed='\033[1;31m' # Red | |
BGreen='\033[1;32m' # Green | |
BYellow='\033[1;33m' # Yellow | |
BBlue='\033[1;34m' # Blue | |
BPurple='\033[1;35m' # Purple | |
BCyan='\033[1;36m' # Cyan | |
BWhite='\033[1;37m' # White | |
NC='\033[0m' | |
ALACRITTY_BIN="/Applications/Alacritty.app/Contents/MacOS/alacritty" | |
if [ ! -x "${ALACRITTY_BIN}" ]; then | |
printf "${BRed}Error:${NC} ${ALACRITTY_BIN} is not executable\n" | |
exit 1 | |
fi | |
ALACRITTY_INSTALLED_VERSION=$(${ALACRITTY_BIN} --version) | |
S=($ALACRITTY_INSTALLED_VERSION) | |
LOCAL_NUMBER=${S[1]} | |
ALACRITTY_RELEASE_PAGE="https://github.com/alacritty/alacritty/releases" | |
LAST_RELEASED_VERSION=$( | |
w3m -dump ${ALACRITTY_RELEASE_PAGE} | | |
grep "Version" | | |
head -n 1 | |
) | |
if [ "$LAST_RELEASED_VERSION" == "" ]; then | |
printf "${BRed}Oups!${NC} Something wrong with ${ALACRITTY_RELEASE_PAGE}\n" | |
exit 1 | |
fi | |
S=($LAST_RELEASED_VERSION) | |
RELEASE_NUMBER=${S[2]} | |
if [ ${LOCAL_NUMBER} == ${RELEASE_NUMBER} ]; then | |
printf "${BGreen}YES!${NC} You are up to date (ver ${BYellow}${LOCAL_NUMBER}${NC})\n" | |
else | |
printf "${BRed}Update is Here!${NC}\n" | |
printf "On net is new versin: ${BYellow}${RELEASE_NUMBER}${NC}\n" | |
printf "Installed version: ${BGreen}${LOCAL_NUMBER}${NC}\n" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment