Skip to content

Commit

Permalink
add context parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
ariary authored Jan 26, 2022
1 parent ca00c83 commit a003fdb
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion fsource
Original file line number Diff line number Diff line change
@@ -1,5 +1,24 @@
#!/bin/bash

CONTEXT=""
while getopts ":C:" opt; do
case $opt in
C) CONTEXT="$OPTARG"
;;
\?) echo "Invalid option -$OPTARG" >&2
exit 1
;;
esac

case $OPTARG in
-*) echo "Option $opt needs a valid argument"
exit 1
;;
esac
done

if [ -z "$CONTEXT" ]; then CONTEXT="0";fi

## TODO: Enhance parent|top|frames to ctach only parent/top/frames[i].obj


Expand All @@ -19,4 +38,4 @@ OTHERS_OBJ_SOURCES="event.data|onmessage|opener|parent|top|frames"

SOURCES="$LOCATION_SOURCES|$COOKIE_SOURCES|$REFERER_SOURCES|$WINDOWS_SOURCES|$HISTORY_SOURCES|$INDIRECT_SOURCES|$OTHERS_OBJ_SOURCES"

grep --color -E $SOURCES /dev/stdin
grep --color -E $SOURCES -C $CONTEXT /dev/stdin

0 comments on commit a003fdb

Please sign in to comment.