2014-03-04 23:16:26 +01:00
|
|
|
OK=0
|
|
|
|
KO=0
|
|
|
|
|
2014-05-12 12:14:41 +02:00
|
|
|
PASS='✔'
|
|
|
|
FAIL='✘'
|
|
|
|
|
2015-02-13 05:43:23 +01:00
|
|
|
# by default show installed versions
|
|
|
|
NO_VERSION=1
|
|
|
|
if [[ "$1" == "--no-version" ]]; then
|
|
|
|
NO_VERSION=0
|
|
|
|
fi
|
|
|
|
|
2014-05-12 12:14:41 +02:00
|
|
|
if [[ $TERM == xterm-*color ]]; then
|
|
|
|
PASS="\E[32m$PASS\E[0m"
|
|
|
|
FAIL="\E[31m$FAIL\E[0m"
|
|
|
|
fi
|
|
|
|
|
2015-02-12 14:52:54 +01:00
|
|
|
# $1 command name
|
2015-02-13 05:43:23 +01:00
|
|
|
# $2 0 OK, anything else KO
|
|
|
|
# $3 optional version string, should send in quotes
|
2014-03-04 23:16:26 +01:00
|
|
|
_dq_report () {
|
2014-05-12 12:14:41 +02:00
|
|
|
if [ "$2" -eq 0 ]; then
|
2015-02-13 05:43:23 +01:00
|
|
|
if [ "$NO_VERSION" -eq 0 ]; then
|
|
|
|
printf "$PASS $1\n"
|
|
|
|
else
|
|
|
|
printf "$PASS %-30s %s\n" $1 $3
|
|
|
|
fi
|
2014-05-12 12:14:41 +02:00
|
|
|
OK=$(($OK+1))
|
|
|
|
else
|
2015-02-13 05:43:23 +01:00
|
|
|
printf "$FAIL $1\n"
|
2014-05-12 12:14:41 +02:00
|
|
|
KO=$(($KO+1))
|
|
|
|
fi
|
2014-03-04 23:16:26 +01:00
|
|
|
}
|