From 8603e914579309387ff0506d3ed69b98747c0104 Mon Sep 17 00:00:00 2001 From: Jack Stockley Date: Fri, 18 Mar 2022 09:40:29 +0000 Subject: [PATCH] fix: addinng fix to bashrc and brew check adding fix to remove . from bashrc file adding fix to brew version script to if statement to pick up the count when seeing number of outdated packages from brew --- bashrc | 4 ++-- brew-version-check.bash | 36 ++++++++++++++++++++++++------------ 2 files changed, 26 insertions(+), 14 deletions(-) diff --git a/bashrc b/bashrc index fad08f5..d28facc 100644 --- a/bashrc +++ b/bashrc @@ -10,10 +10,10 @@ source <(kubectl completion bash) ## read aliases file if [ -f ~/.bash_aliases ]; then - . ~/..bash_aliases + . ~/.bash_aliases fi ## read function file if [ -f ~/.bash_functions ]; then - . ~/..bash_functions + . ~/.bash_functions fi \ No newline at end of file diff --git a/brew-version-check.bash b/brew-version-check.bash index c1b4fbe..6674a47 100644 --- a/brew-version-check.bash +++ b/brew-version-check.bash @@ -1,33 +1,45 @@ #!/bin/bash +#set -x +bold="$(tput bold)" +underline="$(tput smul)" +standout="$(tput smso)" +normal="$(tput sgr0)" +black="$(tput setaf 0)" +red="$(tput setaf 1)" +green="$(tput setaf 2)" +yellow="$(tput setaf 3)" +blue="$(tput setaf 4)" +magenta="$(tput setaf 5)" +cyan="$(tput setaf 6)" +white="$(tput setaf 7)" -echo -e "Current Package Versions" -brew list --versions awscli git kubectl vim go tfenv aws-vault -echo -e "Would you like to continue to view outdated package versions?" +echo -e "\n${bold}${yellow}Current Package Versions${normal}" +brew list --versions awscli git kubectl vim go tfenv aws-vault cloud-platform-cli helm +echo -e "\n${yellow}Would you like to continue to view outdated package versions?${normal}" read -p '[y/n]: ' yesnovar if [ $yesnovar == n ]; then exit 0 elif [ $yesnovar == y ]; then - echo -e "\nOutdated Versions" - outdated=`brew outdated` - count=${outdated} | wc -l - echo "${outdated}" - if [ ${count} > 0 ]; then - echo -e "\nWould you like to upgrade outdated packages?" + echo -e "\n${bold}${yellow}Outdated Versions${normal}" + brew outdated + outdated=`brew outdated | wc -l` + if [[ $outdated -gt 0 ]]; then + echo -e "\n${yellow}Would you like to upgrade outdated packages?${normal}" read -p '[y/n]: ' yesnovar if [ $yesnovar == n ]; then exit elif [ $yesnovar == y ]; then brew upgrade else - echo "Unknown Response $yesnovar" + echo -e "\n${bold}${red}Unknown Response $yesnovar${normal}" exit 1 fi else - echo -e "Nothing to upgrade" + echo -e "${green}Nothing to upgrade${normal}" exit fi else - echo "Unknown Response $yesnovar" + echo -e "\n${bold}${red}Unknown Response $yesnovar${normal}" exit 1 fi