Commit | Line | Data |
---|---|---|
73564bf6 BA |
1 | #!/bin/bash |
2 | # Count code lines ( using answer https://stackoverflow.com/a/965072 ) | |
3 | ||
4 | function countFoldExt() | |
5 | { | |
6 | count=0 | |
7 | for fullfile in `find $1`; do | |
8 | filename=$(basename -- "$fullfile") | |
9 | extension="${filename##*.}" | |
10 | if [ "$extension" == "$2" ]; then | |
11 | count=$((count+`wc -l $fullfile | grep -o ^[0-9]*`)) | |
12 | fi | |
13 | done | |
14 | echo $count | |
15 | } | |
16 | ||
17 | count=0 | |
18 | count=$((count + $(countFoldExt "app.js" "js"))) | |
19 | count=$((count + $(countFoldExt "gulpfile.js" "js"))) | |
20 | count=$((count + $(countFoldExt "sockets.js" "js"))) | |
21 | count=$((count + $(countFoldExt "bin" "www"))) | |
22 | count=$((count + $(countFoldExt "db" "sql"))) | |
23 | count=$((count + $(countFoldExt "public" "js"))) | |
24 | count=$((count + $(countFoldExt "public" "sass"))) | |
25 | count=$((count + $(countFoldExt "routes" "js"))) | |
26 | count=$((count + $(countFoldExt "views" "pug"))) | |
27 | echo $count |