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

Merge pull request #9 from dexterous/master

Update reporter; colourize output
This commit is contained in:
Kunal Dabir 2014-05-12 15:52:26 +03:00
commit 055457d499
12 changed files with 176 additions and 88 deletions

View File

@ -1,14 +1,22 @@
OK=0
KO=0
PASS='✔'
FAIL='✘'
if [[ $TERM == xterm-*color ]]; then
PASS="\E[32m$PASS\E[0m"
FAIL="\E[31m$FAIL\E[0m"
fi
_dq_report () {
if [ "$2" -eq 0 ]; then
echo "$1"
OK=$(($OK+1))
else
echo "$1"
KO=$(($KO+1))
fi
if [ "$2" -eq 0 ]; then
echo -e "$PASS $1"
OK=$(($OK+1))
else
echo -e "$FAIL $1"
KO=$(($KO+1))
fi
}
ack --version > /dev/null 2>&1
@ -127,6 +135,6 @@ _dq_report 'yeoman' $?
zsh --version > /dev/null 2>&1
_dq_report 'zsh' $?
echo Your dq is $OK / $(($OK+$KO))
echo; echo Your dq is $OK / $(($OK+$KO))
exit $KO

View File

@ -1,14 +1,22 @@
OK=0
KO=0
PASS='✔'
FAIL='✘'
if [[ $TERM == xterm-*color ]]; then
PASS="\E[32m$PASS\E[0m"
FAIL="\E[31m$FAIL\E[0m"
fi
_dq_report () {
if [ "$2" -eq 0 ]; then
echo "$1"
OK=$(($OK+1))
else
echo "$1"
KO=$(($KO+1))
fi
if [ "$2" -eq 0 ]; then
echo -e "$PASS $1"
OK=$(($OK+1))
else
echo -e "$FAIL $1"
KO=$(($KO+1))
fi
}
## surprisingly no option for version that i could find of
@ -21,6 +29,6 @@ _dq_report 'java' $?
lein -v > /dev/null 2>&1
_dq_report 'leiningen' $?
echo Your dq is $OK / $(($OK+$KO))
echo; echo Your dq is $OK / $(($OK+$KO))
exit $KO

View File

@ -1,14 +1,22 @@
OK=0
KO=0
PASS='✔'
FAIL='✘'
if [[ $TERM == xterm-*color ]]; then
PASS="\E[32m$PASS\E[0m"
FAIL="\E[31m$FAIL\E[0m"
fi
_dq_report () {
if [ "$2" -eq 0 ]; then
echo "$1"
OK=$(($OK+1))
else
echo "$1"
KO=$(($KO+1))
fi
if [ "$2" -eq 0 ]; then
echo -e "$PASS $1"
OK=$(($OK+1))
else
echo -e "$FAIL $1"
KO=$(($KO+1))
fi
}
curl --version > /dev/null 2>&1
@ -33,6 +41,6 @@ _dq_report 'ruby' $?
vi --version > /dev/null 2>&1
_dq_report 'vi' $?
echo Your dq is $OK / $(($OK+$KO))
echo; echo Your dq is $OK / $(($OK+$KO))
exit $KO

View File

@ -1,14 +1,22 @@
OK=0
KO=0
PASS='✔'
FAIL='✘'
if [[ $TERM == xterm-*color ]]; then
PASS="\E[32m$PASS\E[0m"
FAIL="\E[31m$FAIL\E[0m"
fi
_dq_report () {
if [ "$2" -eq 0 ]; then
echo "$1"
OK=$(($OK+1))
else
echo "$1"
KO=$(($KO+1))
fi
if [ "$2" -eq 0 ]; then
echo -e "$PASS $1"
OK=$(($OK+1))
else
echo -e "$FAIL $1"
KO=$(($KO+1))
fi
}
mongo --version > /dev/null 2>&1
@ -23,6 +31,6 @@ _dq_report 'mysql client' $?
psql --version > /dev/null 2>&1
_dq_report 'postgres client' $?
echo Your dq is $OK / $(($OK+$KO))
echo; echo Your dq is $OK / $(($OK+$KO))
exit $KO

View File

@ -1,14 +1,22 @@
OK=0
KO=0
PASS='✔'
FAIL='✘'
if [[ $TERM == xterm-*color ]]; then
PASS="\E[32m$PASS\E[0m"
FAIL="\E[31m$FAIL\E[0m"
fi
_dq_report () {
if [ "$2" -eq 0 ]; then
echo "$1"
OK=$(($OK+1))
else
echo "$1"
KO=$(($KO+1))
fi
if [ "$2" -eq 0 ]; then
echo -e "$PASS $1"
OK=$(($OK+1))
else
echo -e "$FAIL $1"
KO=$(($KO+1))
fi
}
bower --version > /dev/null 2>&1
@ -46,6 +54,6 @@ _dq_report 'vi' $?
yo --version > /dev/null 2>&1
_dq_report 'yeoman' $?
echo Your dq is $OK / $(($OK+$KO))
echo; echo Your dq is $OK / $(($OK+$KO))
exit $KO

View File

@ -1,14 +1,22 @@
OK=0
KO=0
PASS='✔'
FAIL='✘'
if [[ $TERM == xterm-*color ]]; then
PASS="\E[32m$PASS\E[0m"
FAIL="\E[31m$FAIL\E[0m"
fi
_dq_report () {
if [ "$2" -eq 0 ]; then
echo "$1"
OK=$(($OK+1))
else
echo "$1"
KO=$(($KO+1))
fi
if [ "$2" -eq 0 ]; then
echo -e "$PASS $1"
OK=$(($OK+1))
else
echo -e "$FAIL $1"
KO=$(($KO+1))
fi
}
gradle -v > /dev/null 2>&1
@ -22,6 +30,6 @@ _dq_report 'java' $?
lazybones --version > /dev/null 2>&1
_dq_report 'lazybones' $?
echo Your dq is $OK / $(($OK+$KO))
echo; echo Your dq is $OK / $(($OK+$KO))
exit $KO

View File

@ -1,14 +1,22 @@
OK=0
KO=0
PASS='✔'
FAIL='✘'
if [[ $TERM == xterm-*color ]]; then
PASS="\E[32m$PASS\E[0m"
FAIL="\E[31m$FAIL\E[0m"
fi
_dq_report () {
if [ "$2" -eq 0 ]; then
echo "$1"
OK=$(($OK+1))
else
echo "$1"
KO=$(($KO+1))
fi
if [ "$2" -eq 0 ]; then
echo -e "$PASS $1"
OK=$(($OK+1))
else
echo -e "$FAIL $1"
KO=$(($KO+1))
fi
}
ant -version > /dev/null 2>&1
@ -25,6 +33,6 @@ _dq_report 'javac' $?
mvn -v > /dev/null 2>&1
_dq_report 'maven' $?
echo Your dq is $OK / $(($OK+$KO))
echo; echo Your dq is $OK / $(($OK+$KO))
exit $KO

View File

@ -1,14 +1,22 @@
OK=0
KO=0
PASS='✔'
FAIL='✘'
if [[ $TERM == xterm-*color ]]; then
PASS="\E[32m$PASS\E[0m"
FAIL="\E[31m$FAIL\E[0m"
fi
_dq_report () {
if [ "$2" -eq 0 ]; then
echo "$1"
OK=$(($OK+1))
else
echo "$1"
KO=$(($KO+1))
fi
if [ "$2" -eq 0 ]; then
echo -e "$PASS $1"
OK=$(($OK+1))
else
echo -e "$FAIL $1"
KO=$(($KO+1))
fi
}
bundle -v > /dev/null 2>&1
@ -26,6 +34,6 @@ _dq_report 'ruby' $?
rvm -v > /dev/null 2>&1
_dq_report 'rvm' $?
echo Your dq is $OK / $(($OK+$KO))
echo; echo Your dq is $OK / $(($OK+$KO))
exit $KO

View File

@ -1,14 +1,22 @@
OK=0
KO=0
PASS='✔'
FAIL='✘'
if [[ $TERM == xterm-*color ]]; then
PASS="\E[32m$PASS\E[0m"
FAIL="\E[31m$FAIL\E[0m"
fi
_dq_report () {
if [ "$2" -eq 0 ]; then
echo "$1"
OK=$(($OK+1))
else
echo "$1"
KO=$(($KO+1))
fi
if [ "$2" -eq 0 ]; then
echo -e "$PASS $1"
OK=$(($OK+1))
else
echo -e "$FAIL $1"
KO=$(($KO+1))
fi
}
java -version > /dev/null 2>&1
@ -32,6 +40,6 @@ _dq_report 'scala' $STATUS
scalac -version > /dev/null 2>&1
_dq_report 'scalac' $?
echo Your dq is $OK / $(($OK+$KO))
echo; echo Your dq is $OK / $(($OK+$KO))
exit $KO

View File

@ -1,14 +1,22 @@
OK=0
KO=0
PASS='✔'
FAIL='✘'
if [[ $TERM == xterm-*color ]]; then
PASS="\E[32m$PASS\E[0m"
FAIL="\E[31m$FAIL\E[0m"
fi
_dq_report () {
if [ "$2" -eq 0 ]; then
echo "$1"
OK=$(($OK+1))
else
echo "$1"
KO=$(($KO+1))
fi
if [ "$2" -eq 0 ]; then
echo -e "$PASS $1"
OK=$(($OK+1))
else
echo -e "$FAIL $1"
KO=$(($KO+1))
fi
}
ack --version > /dev/null 2>&1
@ -26,6 +34,6 @@ _dq_report 'wget' $?
zsh --version > /dev/null 2>&1
_dq_report 'zsh' $?
echo Your dq is $OK / $(($OK+$KO))
echo; echo Your dq is $OK / $(($OK+$KO))
exit $KO

View File

@ -1,3 +1,3 @@
echo Your dq is $OK / $(($OK+$KO))
echo; echo Your dq is $OK / $(($OK+$KO))
exit $KO

View File

@ -1,12 +1,20 @@
OK=0
KO=0
PASS='✔'
FAIL='✘'
if [[ $TERM == xterm-*color ]]; then
PASS="\E[32m$PASS\E[0m"
FAIL="\E[31m$FAIL\E[0m"
fi
_dq_report () {
if [ "$2" -eq 0 ]; then
echo "$1"
OK=$(($OK+1))
else
echo "$1"
KO=$(($KO+1))
fi
if [ "$2" -eq 0 ]; then
echo -e "$PASS $1"
OK=$(($OK+1))
else
echo -e "$FAIL $1"
KO=$(($KO+1))
fi
}