From b88376f929ca5b5d1b7d1a488f10a53d6cd07704 Mon Sep 17 00:00:00 2001 From: Veit Heller Date: Mon, 30 Jun 2014 14:29:04 +0200 Subject: [PATCH] Better update function --- bash_profile | 29 +++++++++++++++++++++-------- zshrc | 29 +++++++++++++++++++++-------- 2 files changed, 42 insertions(+), 16 deletions(-) diff --git a/bash_profile b/bash_profile index 74d7112..a265bd6 100644 --- a/bash_profile +++ b/bash_profile @@ -65,12 +65,25 @@ pinfo(){ } update(){ - echo "Updating homebrew formulae" - brew update > /dev/null - echo "Updating installed sources(Homebrew)" - brew upgrade outdated &> /dev/null - echo "Updating MacPorts (sudo required)" - sudo port selfupdate > /dev/null - echo "Updating installed sources(MacPorts)" - sudo port upgrade outdated > /dev/null + yellow='\e[1;33m' + none='\e[0m' + if $1 == '-v' ; then + echo -e "${yellow}Updating homebrew formulae${none}" + brew update + echo -e "${yellow}Updating installed sources(Homebrew)${none}" + brew upgrade outdated + echo -e "${yellow}Updating MacPorts (sudo required)${none}" + sudo port selfupdate + echo -e "${yellow}Updating installed sources(MacPorts)${none}" + sudo port upgrade outdated + else + echo -e "${yellow}Updating homebrew formulae${none}" + brew update &> /dev/null + echo -e "${yellow}Updating installed sources(Homebrew)${none}" + brew upgrade outdated &> /dev/null + echo -e "${yellow}Updating MacPorts (sudo required)${none}" + sudo port selfupdate &> /dev/null + echo -e "${yellow}Updating installed sources(MacPorts)${none}" + sudo port upgrade outdated & /dev/null + fi } diff --git a/zshrc b/zshrc index e5b92b5..904063c 100644 --- a/zshrc +++ b/zshrc @@ -99,12 +99,25 @@ pinfo(){ } update(){ - echo "Updating homebrew formulae" - brew update > /dev/null - echo "Updating installed sources(Homebrew)" - brew upgrade outdated &> /dev/null - echo "Updating MacPorts (sudo required)" - sudo port selfupdate > /dev/null - echo "Updating installed sources(MacPorts)" - sudo port upgrade outdated > /dev/null + yellow='\e[1;33m' + none='\e[0m' + if $1 == '-v' ; then + echo -e "${yellow}Updating homebrew formulae${none}" + brew update + echo -e "${yellow}Updating installed sources(Homebrew)${none}" + brew upgrade outdated + echo -e "${yellow}Updating MacPorts (sudo required)${none}" + sudo port selfupdate + echo -e "${yellow}Updating installed sources(MacPorts)${none}" + sudo port upgrade outdated + else + echo -e "${yellow}Updating homebrew formulae${none}" + brew update &> /dev/null + echo -e "${yellow}Updating installed sources(Homebrew)${none}" + brew upgrade outdated &> /dev/null + echo -e "${yellow}Updating MacPorts (sudo required)${none}" + sudo port selfupdate &> /dev/null + echo -e "${yellow}Updating installed sources(MacPorts)${none}" + sudo port upgrade outdated & /dev/null + fi }