Last active
June 23, 2017 22:58
-
-
Save WilliamDenniss/de8fa10dd8d8ba9b10a6598ec7218c55 to your computer and use it in GitHub Desktop.
Counts the number of helm tests in subfolders
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Iterates all subdirectors of the current path. | |
for d in */ ; do | |
# Count instances of test annotations in folder. | |
COUNT=`egrep -r "test-success|test-failure" "$d" | wc -l` | |
# Colors! | |
COUNT_COLOR=$([ $COUNT -gt 0 ] && echo "$(tput setaf 2)" || echo "$(tput setaf 1)") | |
BLACK=$(tput setaf 0) | |
# Strip slash from directory name | |
CHART=`echo "$d" | sed -E "s/(.*)\//\1/"` | |
# Output | |
printf "%-30s %s%s test(s)%s\n" $CHART $COUNT_COLOR $COUNT $BLACK | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment