Skip to content

Instantly share code, notes, and snippets.

@davidchambers
Created November 2, 2012 18:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save davidchambers/4003513 to your computer and use it in GitHub Desktop.
Save davidchambers/4003513 to your computer and use it in GitHub Desktop.
Visualize significant lines of code for a directory of source files
#!/usr/bin/env bash
echo
for filename in $(find $1); do
loc=$(sed /^\s*$/d $filename | wc -l)
printf %24s $(echo $filename | sed 's!.*/!!')
printf %8s $loc
echo -n ' '
indent=$(seq -s ' ' 36 | sed s/[0-9]//g)
seq -s '+' $loc | sed -e s/[0-9]//g -e "s/.\{100\}/&,$indent/g" | tr , '\n'
echo
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment