Created
May 7, 2019 08:59
-
-
Save yukihirai0505/5975d65de1bfbf3c4495f4e45bca913f to your computer and use it in GitHub Desktop.
Counting lines of code (specific directories and files)
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
#!/usr/bin/env bash | |
# cloc ver | |
MODULES=(hoge fuga piyo) | |
for MODULE in "${MODULES[@]}" | |
do | |
TARGET_DIC=./${MODULE} | |
cloc ${TARGET_DIC} --read-lang-def=$HOME/cloc/language-defs.txt --include-lang=Java,PHP | awk -v env_var="${MODULE}" 'FNR == 12 {print "|" env_var "|" $3+$4+$5 "|" $4+$5 "|"}' | |
done |
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
#!/usr/bin/env bash | |
# pure script ver | |
MODULES=(hoge fuga piyo) | |
for MODULE in "${MODULES[@]}" | |
do | |
echo $MODULE | |
TARGET_DIC=./${MODULE} | |
EXCEPT_DIC=${TARGET_DIC}/build | |
find ${TARGET_DIC} -path ${EXCEPT_DIC} -prune -o -name '*.gs' -o -name '*.gsx' | xargs wc -l 2>/dev/null | awk 'END{print $1}' | |
find ${TARGET_DIC} -path ${EXCEPT_DIC} -prune -o -name '*.gs' -o -name '*.gsx' | xargs sed '/^[[:space:]]*$/d' | wc -l | awk '{print $1"(no blank)"}' | |
echo "===" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment