Created
September 17, 2024 11:23
-
-
Save msankhala/387038f70b64dc328762bd678c8a1dd4 to your computer and use it in GitHub Desktop.
Get the count of directory in a given folder based on the pattern.
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
#!/usr/bin/env bash | |
function getColorfulString() { | |
RED='\033[0;31m' | |
NC='\033[0m' # No Color | |
# 30-37 sets foreground color | |
# 40-47 sets background color | |
echo "$RED$1$NC" | |
} | |
numberOfDir="find src/components/ -type f -exec dirname {} \; | sort -u | wc -l" | |
numberOfDirExcludeTets="find src/components/ -type f -exec dirname {} \; | grep -Ev 'test$|tests$' | sort -u | wc -l" | |
numberOfDirExcludeTetsIncludingJsFiles="find src/components/ -type f -name '**.js' -exec dirname {} \; | grep -Ev 'test$|tests$' | sort -u | wc -l" | |
numberOfDirExcludeTetsIncludingUiPatternFiles="find src/components/ -type f -name '**.ui_patterns.yml' -exec dirname {} \; | grep -Ev 'test$|tests$' | sort -u | wc -l" | |
echo -e `getColorfulString "$numberOfDir"` | |
printf 'Number of directories in src/components: \n'; | |
eval $numberOfDir | |
echo -e `getColorfulString "$numberOfDirExcludeTets"` | |
printf 'Number of directories in src/components excluding test/tests folders: \n'; | |
eval $numberOfDirExcludeTets | |
echo -e `getColorfulString "$numberOfDirExcludeTetsIncludingJsFiles"` | |
printf 'Number of directories in src/components including JS files and excluding test/tests folders: \n'; | |
eval $numberOfDirExcludeTetsIncludingJsFiles | |
echo -e `getColorfulString "$numberOfDirExcludeTetsIncludingUiPatternFiles"` | |
printf 'Number of directories in src/components including ui_patterns.yml files and excluding test/tests folders: \n'; | |
eval $numberOfDirExcludeTetsIncludingUiPatternFiles |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment