Advertisement
Shnatsel

Find undocumented items in valadoc

Apr 6th, 2014
229
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.24 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. [ -z "$1" ] && echo "Usage: $0 "'/directory/with/valadoc-generated-html/**
  4.  Processing several dirs at once is supported.
  5.  Make sure you add ** after the names to make the shell list files recursively.'
  6.  
  7. ( # start a subshell so we can grab all the output at once and pipe it
  8.     ( # and another one, for deduplication this time
  9.         for file in "$@"; do
  10.             if (basename "$file" | grep -q ".html"); then
  11.                 sed -n -e '/div class="site_content"/,$p' "$file" \
  12.                    | tr --delete '\n' \
  13.                    | sed 's|</li>|&\n|g' \
  14.                    | grep 'li class=' \
  15.                    | grep -v 'class="deprecated"' \
  16.                    | sed --regexp-extended 's|<div class="leaf_brief_description">[[:space:]]*</div>||' \
  17.                    | grep -v 'brief_description'
  18.             fi
  19.         done
  20.     ) | grep "href" | while read line; do
  21.         line="${line##*<li}"
  22.         type="$(echo "$line" | cut -d \" -f 2)"
  23.         name="$(echo ${line#*href=} | cut -d \" -f 2)"
  24.         echo "$type ${name%.htm*}"
  25.     done
  26. # Beware: Dark awk magic ahead!
  27. # Source: http://www.unixcl.com/2008/03/remove-duplicates-without-sorting-file.html
  28. ) | grep -v 'virtual_method' | awk ' !x[$0]++' -
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement