]> git.saurik.com Git - cycript.git/blob - Filter.sh
Prefer __NSCFBoolean to non-__ for iOS compatibility.
[cycript.git] / Filter.sh
1 #!/usr/bin/env bash
2
3 filters=("$@")
4
5 while IFS= read -r line; do
6 if [[ ${line} = @if* ]]; then
7 line=${line#@if }
8 for name in "${filters[@]}"; do
9 if [[ ${line} = ${name}' '* ]]; then
10 echo "${line#${name} }"
11 fi
12 done
13 elif [[ ${line} = @begin* ]]; then
14 set ${line}; shift
15 filter=
16 for name in "${filters[@]}"; do
17 for side in "$@"; do
18 if [[ ${name} == ${side} ]]; then
19 unset filter
20 fi
21 done
22 done
23 elif [[ ${line} = @end ]]; then
24 unset filter
25 elif [[ -z ${filter+@} ]]; then
26 echo "${line}"
27 fi
28 done