-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathloc.sh
More file actions
executable file
·50 lines (39 loc) · 798 Bytes
/
loc.sh
File metadata and controls
executable file
·50 lines (39 loc) · 798 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/bin/bash
set -euo pipefail
cd $(dirname $0)
TOTAL=0
count() {
local name=$1; shift
local where=$@
local lines=$(eval git ls-files $where | $name | xargs wc -l | awk 'END { print $1 }')
echo "$name $lines" | sed -s 's|_|/|g'
TOTAL=$((TOTAL+lines))
}
Rust_code() {
grep -E '\.rs$' \
| grep -vE '^src/tests|^tests|^src/bin/bench.rs$'
}
Rust_test() {
grep -E '\.rs$' \
| grep -E '^src/tests|^tests|^src/bin/bench.rs$'
}
Foolang() {
grep -E '.foo$'
}
C() {
grep -E '.c$'
}
Elisp() {
grep -E '.el$'
}
Markdown() {
grep -E '.(md)$'
}
count "Foolang " foo
count "Markdown " docs
count "Elisp " elisp
count "C " c runtime tests
count "Rust_code " .
count "Rust_test " .
echo "---------------"
echo " Total" $TOTAL