diff options
author | Florian Pritz <bluewind@xinu.at> | 2012-12-19 23:20:13 +0100 |
---|---|---|
committer | Allan McRae <allan@archlinux.org> | 2013-01-03 03:03:10 +0100 |
commit | dd3762edc4b1eb0cde2610164fd4f1a496e671b9 (patch) | |
tree | c0babfbf624f61c7b3e818a6849232a6096359a7 /contrib/pacdiff.sh.in | |
parent | 2616cb5fdce0c54e829a88318d671dd5032f0aac (diff) | |
download | pacman-dd3762edc4b1eb0cde2610164fd4f1a496e671b9.tar.gz pacman-dd3762edc4b1eb0cde2610164fd4f1a496e671b9.tar.xz |
pacdiff: color filename and mention what we found
Signed-off-by: Florian Pritz <bluewind@xinu.at>
Signed-off-by: Allan McRae <allan@archlinux.org>
Diffstat (limited to 'contrib/pacdiff.sh.in')
-rw-r--r-- | contrib/pacdiff.sh.in | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/contrib/pacdiff.sh.in b/contrib/pacdiff.sh.in index bfafda26..58494e19 100644 --- a/contrib/pacdiff.sh.in +++ b/contrib/pacdiff.sh.in @@ -24,6 +24,22 @@ diffprog=${DIFFPROG:-vimdiff} diffsearchpath=${DIFFSEARCHPATH:-/etc} locate=0 +if tput setaf 0 &>/dev/null; then + ALL_OFF="$(tput sgr0)" + BOLD="$(tput bold)" + BLUE="${BOLD}$(tput setaf 4)" + GREEN="${BOLD}$(tput setaf 2)" + YELLOW="${BOLD}$(tput setaf 3)" + PURPLE="${BOLD}$(tput setaf 5)" +else + ALL_OFF="\e[1;0m" + BOLD="\e[1;1m" + BLUE="${BOLD}\e[1;34m" + GREEN="${BOLD}\e[1;32m" + YELLOW="${BOLD}\e[1;33m" + PURPLE="${BOLD}\e[1;35m" +fi + usage() { echo "$myname : a simple pacnew/pacorig/pacsave updater" echo "Usage : $myname [-l]" @@ -62,7 +78,15 @@ fi # see http://mywiki.wooledge.org/BashFAQ/020 while IFS= read -u 3 -r -d '' pacfile; do file="${pacfile%.pac*}" - echo "File: $file" + file_type="pac${pacfile##*.pac}" + + case $file_type in + pacnew) printf "$GREEN%s$ALL_OFF" "$file_type";; + pacorig) printf "$YELLOW%s$ALL_OFF" "$file_type";; + pacsave) printf "$BLUE%s$ALL_OFF" "$file_type";; + esac + + printf " file found for $PURPLE%s$ALL_OFF\n" "$file" if [ ! -f "$file" ]; then echo " $file does not exist" rm -i "$pacfile" |