]> git.saurik.com Git - cycript.git/blame_incremental - Filter.sh
While libedit requires me to damage rl_basic_word_break_characters, readline requires...
[cycript.git] / Filter.sh
... / ...
CommitLineData
1#!/usr/bin/env bash
2
3filters=("$@")
4
5while 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
28done