3 # Print TODO, FIXME, HACK and NOTE entries from source code files.
11 print_line_numbers
="yes"
16 for file in `find . \( ! -regex '.*/\..*' -a -name "*.cpp" -o -name "*.h" \) -type f`
18 grep -n -E '^\W*// (TODO|FIXME|HACK|NOTE):' $file |
while read entry
20 local line_num
=`echo "$entry" | cut -f 1 -d :`
21 local entry_type
=`echo "$entry" | cut -f 2 -d : | sed -e 's/^\W*//g'`
22 local entry_text
="`echo $entry | cut -f 3 -d : | sed -e 's/^\W*//g'`"
24 # Should we print this type of entry?
25 local print_this_type
="yes"
29 if [ $print_todos = "no" ]; then
35 if [ $print_fixmes = "no" ]; then
41 if [ $print_hacks = "no" ]; then
47 if [ $print_notes = "no" ]; then
53 if [ $print_this_type = "yes" ]
55 if [ $print_file_name = "no" ]
57 echo "$entry_type: $entry_text"
59 if [ $print_line_numbers = "no" ]
61 echo "$file: $entry_type: $entry_text"
63 echo "$file:$line_num: $entry_type: $entry_text"
73 echo "Usage: src-entries.sh [options]"
75 echo "Print TODO, FIXME, HACK and NOTE entries from source code files. All"
76 echo "entries are printed by default with the file name and line number."
78 echo "The entries must be in format:"
80 echo " <whitespace>// [TODO|FIXME|HACK|NOTE]: <text>"
82 echo "Only one entry per line (text included) is currently supported."
86 echo " --no-file-name don't print the file name where the entry came from"
87 echo " --no-line-number don't print the line number where the entry came from"
88 echo " --no-todos don't print TODO entries"
89 echo " --no-fixmes don't print FIXME entries"
90 echo " --no-hacks don't print HACK entries"
91 echo " --no-notes don't print NOTE entries"
102 # Disable printing line number too as it's pretty much useless
103 # without the file name
104 print_line_numbers
="no"
107 print_line_numbers
="no"