Skip to content

Instantly share code, notes, and snippets.

@bperel
Last active July 25, 2022 13:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bperel/d336ad7669406581bd550d1d5d8462ad to your computer and use it in GitHub Desktop.
Save bperel/d336ad7669406581bd550d1d5d8462ad to your computer and use it in GitHub Desktop.
FV LOC
#!/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}"
for dir in "${dirs[@]}"; do
setColor "$dir"
count=$( ( cd "$dir" && find . -name '*.php' -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 / 1000)) - ${#count} ))
for ((i=0; i < length; i++)); do
echo -en "${color}|"
if [ "$i" -eq $((length / 2)) ]; then
echo -n "$count"
fi
done
echo -en "${NC}"
done
echo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment