Last active
December 15, 2015 06:38
-
-
Save rebx/5217248 to your computer and use it in GitHub Desktop.
Quick unused subroutine finder using ack(http://betterthangrep.com) + git
This file contains 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 | |
dir=$1 | |
if [ -z "$dir" -a "${dir+oinothir}" = "oinothir" ]; then | |
dir=$PWD | |
fi | |
ack -h --output='$1' '^\s*sub\s+(\w+)\b' $dir \ | |
| sort -u \ | |
| while read subname ; do | |
export subname | |
git grep -c -w -F "$subname" \ | |
| awk -F: '{t+=$2} END{if(t<2) print ENVIRON["subname"]}' | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment