]>
Commit | Line | Data |
---|---|---|
7056e6ee | 1 | #!/usr/bin/env bash |
4de0686f JF |
2 | |
3 | filters=("$@") | |
4 | ||
5 | while 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 | |
28 | done |