]> git.saurik.com Git - cycript.git/blame - Filter.sh
Improve isolation of ObjectiveC syntax filter code.
[cycript.git] / Filter.sh
CommitLineData
7056e6ee 1#!/usr/bin/env bash
4de0686f
JF
2
3filters=("$@")
4
5while IFS= read -r line; do
be36c292
JF
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
4de0686f
JF
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
28done