3 quiet fname cmd args ...
5 Runs the passed in command printing only "cmd" and "fname" unless an
6 error occurs in which case it prints the whole command line and
7 colorized program output. Useful for running compilation commands since
8 it removes the cluter, making it easier to spot errors and warnings.
11 # Copyright (c) 2008-2010 LoEE
12 # This program is released under the new BSD license.
22 if [ "$TERM@" = "rxvt@" ]; then
23 GREEN="printf \033[32m"
25 YELLOW="printf \033[33m" # this is not yellow :)
26 NORM="printf \033[m\017"
28 if [ "$OSTYPE@" = "msys@" ]; then
29 OLDATTR=$(eecolor.exe)
30 GREEN="eecolor.exe 0 10"
31 RED="eecolor.exe 0 12"
33 NORM="eecolor.exe ${OLDATTR}"
36 MSG="$(printf "%-16s $1" "$2")"
39 printf "${MSG}\r" 1>&2
44 # if we check $? we won't notice the warnings
45 if [ $RET -ne 0 -o -s quiet.log ]; then
47 if [ $RET -ne 0 ]; then
58 printf "${MSG}\n" 1>&2