5 echo "$(basename $0) [-h] -t <modules|authors|code|this_year> <directory list>"
6 echo " search the listed directories for information"
9 # Determine command options (just -h for help)
10 while getopts "h:t:" OPTION
15 * ) echo "ERROR: Unknown option" ; usage ; exit 1 ;;
23 echo 'ERROR: no type specified'
28 # can we find the code?
30 echo "ERROR: Please specify a list of directories"
35 for REP in ${directory_list}
37 if [ ! -d ${REP} ]; then
38 echo "ERROR: ${REP} is not a directory"
41 if [ ! -d ${REP}/.git ]; then
42 echo "ERROR: cannot find ${REP}/.git"
43 echo "ERROR: ${REP} must be the top of a git repository"
46 ##echo "will search ${REP} for ${type}"
51 ##echo "we are here: ${thisdir}"
52 if [ "${type}" = "modules" ]; then
53 for REP in ${directory_list}; do
54 listm=`find ${REP} -name "*_*.cc" | grep -v test`
55 module_list=`echo ${module_list} ${listm}`
57 num_mod=`echo ${module_list} | wc -w`
59 echo "found ${num_mod} modules"
60 elif [ "${type}" = "authors" ]; then
61 for REP in ${directory_list}; do
63 lista=`git log --all --format='"%cN"' | sort -u`
64 author_list=`echo ${author_list} ${lista}`
69 elif [ "${type}" = "code" ]; then
70 if [[ `type cloc` ]]; then
71 echo "lines of code excluding fcl files and anything in the ups directory"
72 cloc --exclude-dir=ups ${directory_list}
74 echo "ERROR: cannot find the cloc utilitiy"
77 elif [ "${type}" = "this_year" ]; then
78 for REP in ${directory_list}; do
80 listy=`git log --pretty='' --numstat --since 1.year origin/master | grep -v '-' | grep -v ups | cut -f 1 | paste -sd+ - | bc`
82 echo "${REP}: ${listy} lines changed in the last year"
85 echo "ERROR: unrecognized type ${type}"