2
1
mirror of https://github.com/kdabir/has.git synced 2024-11-10 21:26:50 +01:00
has/include/setup.sh

34 lines
566 B
Bash
Raw Normal View History

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