compiler/
lib/
scripts/
count-lines-no-comments.sh
732 B
count-lines.sh
634 B
objdump
63 B
seed/
test/
vim/
.gitignore
353 B
.gitsigners
112 B
LICENSE
1.1 KiB
Makefile
3.0 KiB
README
2.5 KiB
std.lib
1.0 KiB
std.lib.test
252 B
scripts/count-lines.sh
raw
| 1 | #!/bin/sh |
| 2 | # Count non-blank lines in all .rad files, skipping tests. |
| 3 | |
| 4 | dir="${1:-.}" |
| 5 | |
| 6 | if [ ! -d "$dir" ]; then |
| 7 | echo "Error: Directory '$dir' does not exist" |
| 8 | exit 1 |
| 9 | fi |
| 10 | |
| 11 | echo "Counting non-blank lines in .rad files in: $dir" |
| 12 | echo "-------------------------------------------" |
| 13 | |
| 14 | total=0 |
| 15 | for file in $(find "$dir" -name "*.rad" -type f -not -path "*/tests/*" -not -name "tests.rad" | sort); do |
| 16 | if [ -f "$file" ]; then |
| 17 | count=$(grep -v '^[[:space:]]*$' "$file" | wc -l) |
| 18 | total=$((total + count)) |
| 19 | printf "%6d %s\n" "$count" "$file" |
| 20 | fi |
| 21 | done |
| 22 | |
| 23 | echo "-------------------------------------------" |
| 24 | printf "%6d TOTAL\n" "$total" |