Created
August 17, 2022 14:19
-
-
Save bperel/e6f2b59ebfef124e4799fa9f3bbf09dc to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
# shellcheck disable=SC2034 | |
src='\033[0;32m' | |
applications_sv_app_firstvet_com='\033[0;36m' | |
applications_app_firstvet_com='\033[0;35m' | |
NC='\033[0m' # No Color | |
dirs=( "." "applications/app.firstvet.com" "applications/sv.app.firstvet.com" ) | |
setColor() { | |
dir_norm=$(echo "$1" | sed "s/[\/.]/_/g") | |
color=${!dir_norm} | |
} | |
for dir in "${dirs[@]}"; do | |
setColor "$dir" | |
echo -e "${color}| $dir" | |
done | |
echo -ne "${NC}" | |
show() { | |
multiplier=$1 | |
fileRegex=$2 | |
for dir in "${dirs[@]}"; do | |
setColor "$dir" | |
count=$( ( cd "$dir" && find . -regex "$fileRegex" -not -path './infra/*' -not -path './.mysql-data/*' -not -path './applications/*' -not -path './vendor/*' -not -path './node_modules/*' -not -path './*/storage/*' -print0 | xargs -0 cat ) | wc -l) | |
length=$(( $((count / multiplier)) - ${#count} )) | |
if [ $length -le 0 ]; then | |
length=$((count / multiplier)) | |
no_count=1 | |
fi | |
for ((i=0; i < length; i++)); do | |
echo -en "${color}|" | |
if [ "$i" -eq $((length / 2)) ] && [ -n $no_count ]; then | |
echo -n "$count" | |
fi | |
done | |
echo -en "${NC}" | |
done | |
echo | |
} | |
echo | |
echo 'php (1 stroke = 1000 lines)' | |
for i in {21..1}; do | |
git checkout @{"$i".weeks.ago} > /dev/null 2>&1 | |
echo -en "Week "$(( 33-$i ))" " | |
show 1000 '.*\.\(php\)' | |
done | |
git checkout develop > /dev/null 2>&1 | |
echo -ne "Now " | |
show 1000 '.*\.\(php\)' | |
echo 'js+scss+cs (1 stroke = 10000 lines)' | |
for i in {21..1}; do | |
git checkout @{"$i".weeks.ago} > /dev/null 2>&1 | |
echo -ne "Week "$(( 33-$i ))" " | |
show 10000 '.*\.\(js\|css\|scss\)' | |
done | |
git checkout develop > /dev/null 2>&1 | |
echo -ne "Now " | |
show 10000 '.*\.\(js\|css\|scss\)' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment