Created
September 2, 2014 14:09
-
-
Save posva/08ff133f5fbaf739c796 to your computer and use it in GitHub Desktop.
Generates a dirtree (LaTex) view with line count
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
#! /bin/bash | |
L=$(echo index_a6_se_ast.html index_a6_se_tst.html js_a6_se_ast/*.js js_a6_se_tst/*.js js/lib/qtBinding.js js/lib/nuntius.js js_a6_se_tst/css/main.css json/README.md json/genjs.sh json/genjson.py json/a6JSONValidator.js) | |
N=$(cat $L | wc -l) | |
echo "Total $N" | |
old='' | |
for i in $L; do | |
T=$(wc -l $i) | |
lines=$(echo "$T" | cut -d " " -f1) | |
file=$(echo "$T" | cut -d " " -f2) | |
level=$(echo "$file" | sed 's/[^/]//g' | wc -c) | |
dir=$(dirname "$file") | |
if [ ! "$dir" = "$old" ]; then | |
lv=$(echo "$dir" | sed 's/[^/]//g' | wc -c) | |
if [ "$dir" = "." ];then | |
echo ".$lv Total \\DTcomment{$N}." | |
else | |
echo ".$lv $(basename "$dir" | sed 's/_/\\_/g')." | |
fi | |
old="$dir" | |
fi | |
echo ".$level $(basename "$file" | sed 's/_/\\_/g') \\DTcomment{$lines}." | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment