+++ /dev/null
-#!/bin/sh\r
-HELP='Usage:\r
- quiet fname cmd args ...\r
-\r
-Runs the passed in command printing only "cmd" and "fname" unless an\r
-error occurs in which case it prints the whole command line and\r
-colorized program output. Useful for running compilation commands since\r
-it removes the cluter, making it easier to spot errors and warnings.\r
-\r
-'\r
-# Copyright (c) 2008-2010 LoEE\r
-# This program is released under the new BSD license.\r
-\r
-if [ $# -lt 2 ]; then\r
- printf "$HELP"\r
- exit\r
-fi\r
-\r
-GREEN=""\r
-RED=""\r
-NORM=""\r
-if [ "$TERM@" = "rxvt@" ]; then\r
- GREEN="printf \033[32m"\r
- RED="printf \033[31m"\r
- YELLOW="printf \033[33m" # this is not yellow :)\r
- NORM="printf \033[m\017"\r
-fi\r
-if [ "$OSTYPE@" = "msys@" ]; then\r
- OLDATTR=$(eecolor.exe)\r
- GREEN="eecolor.exe 0 10"\r
- RED="eecolor.exe 0 12" \r
- YELLOW="eecolor 0 14"\r
- NORM="eecolor.exe ${OLDATTR}" \r
-fi\r
-\r
-MSG="$(printf "%-16s $1" "$2")"\r
-shift;\r
-\r
-printf "${MSG}\r" 1>&2\r
-\r
-rm -f quiet.log\r
-"$@" 2>> quiet.log\r
-RET=$?\r
-# if we check $? we won't notice the warnings\r
-if [ $RET -ne 0 -o -s quiet.log ]; then\r
- echo "$@" >& 2\r
- if [ $RET -ne 0 ]; then\r
- $RED >& 2\r
- else \r
- $YELLOW >& 2\r
- fi\r
- cat quiet.log >& 2\r
- $NORM &> 2\r
-\r
- exit $RET\r
-else\r
- $GREEN >& 2\r
- printf "${MSG}\n" 1>&2\r
- $NORM >& 2\r
-fi\r
-rm quiet.log\r
-exit $RET\r