Ticket #5347: apis.sh
File apis.sh, 453 bytes (added by mjethani, on 08/08/2017 at 10:58:17 AM) |
---|
Line | |
---|---|
1 | #!/bin/bash -e |
2 | |
3 | # Print out the names of the chrome.* APIs used by Adblock Plus. |
4 | |
5 | # Output to terminal will be with color highlighting. If you're using a black |
6 | # background, you can set GREP_COLOR to "1;32". |
7 | |
8 | apis="$@" |
9 | files=$(hg status -A | sed -n 's/^C //p') |
10 | |
11 | if [ -z $apis ]; then |
12 | apis="$(grep -EwoIsh 'chrome(\.\w+)+' $files | sort -u)" |
13 | fi |
14 | |
15 | for api in $apis; do |
16 | echo "# $api"; echo |
17 | grep -wIn -C5 --color=auto "${api//./\.}" $files |
18 | echo |
19 | done |