1#!/bin/sh 2# 3# Copyright (C) 2014 Masatake YAMATO 4# 5# This program is free software; you can redistribute it and/or modify 6# it under the terms of the GNU General Public License as published by 7# the Free Software Foundation; either version 2 of the License, or 8# (at your option) any later version. 9# 10# This program is distributed in the hope that it will be useful, 11# but WITHOUT ANY WARRANTY; without even the implied warranty of 12# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13# GNU General Public License for more details. 14# 15# You should have received a copy of the GNU General Public License 16# along with this program. If not, see <http://www.gnu.org/licenses/>. 17# 18# ---------------------------------------------------------------------------------------- 19# Show the ratio of the number of files handled by ctags to the number of all files of ctags source directory. 20# ----------------------------------------------------------------------------------------- 21: ${CTAGS_TEST:=./ctags} 22 23# 24# Report all unsupported files 25# 26VERBOSE=0 27 28print_help() 29{ 30 echo "Usage:" 31 echo " $0 -h|--help" 32 echo " $0 [-v|--verbose [-v|--verbose]]" 33 exit $1 34} 35 36while [ $# -gt 0 ]; do 37 case $1 in 38 -h|--help) 39 print_help 0 40 ;; 41 -v|--verbose) 42 VERBOSE=`expr $VERBOSE + 1` 43 ;; 44 -*) 45 echo "unknown option: $1" 46 print_help 1 47 ;; 48 *) 49 echo "unknown expected argument: $1" 50 print_help 1 51 ;; 52 esac 53 shift 54done 55 56CMDLINE="${CTAGS_TEST} --quiet --options=NONE -G --options-maybe=./.ctags.d --languages=all --options-maybe=misc/budge.ctags -R --print-language" 57ALL_FILES=$(git ls-files) 58 59TOTAL=0 60HAS_PARSER=0 61member() 62{ 63 local input=$1 64 local f 65 for f in $ALL_FILES; do 66 if [ "$f" = "$input" ]; then 67 return 0 68 fi 69 done 70 return 1 71} 72 73INPUT= 74LANG= 75${CMDLINE} | { while IFS=': ' read INPUT LANG; do 76 if member "$INPUT"; then 77 if [ "$LANG" != NONE ]; then 78 if [ "$VERBOSE" -gt 1 ]; then 79 printf "%-60s %s\n" $INPUT $LANG 80 fi 81 HAS_PARSER=$(( HAS_PARSER + 1 )) 82 else 83 if [ "${VERBOSE}" -gt 0 ]; then 84 printf "%-60s %s\n" $INPUT NONE 85 fi 86 fi 87 TOTAL=$(( TOTAL + 1 )) 88 fi 89 done 90 echo "[ctags|$(expr 100 '*' $HAS_PARSER / $TOTAL)%]" 91} 92