diff options
Diffstat (limited to '.local/bin/weasel')
-rwxr-xr-x | .local/bin/weasel | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/.local/bin/weasel b/.local/bin/weasel new file mode 100755 index 0000000..ce82ce3 --- /dev/null +++ b/.local/bin/weasel | |||
@@ -0,0 +1,38 @@ | |||
1 | #!/usr/bin/env bash | ||
2 | |||
3 | weasels="many|various|very|fairly|several|extremely\ | ||
4 | |exceedingly|quite|remarkably|few|surprisingly\ | ||
5 | |mostly|largely|huge|tiny|((are|is) a number)\ | ||
6 | |excellent|interestingly|significantly\ | ||
7 | |substantially|clearly|vast|relatively|completely" | ||
8 | |||
9 | wordfile="" | ||
10 | |||
11 | # Check for an alternate weasel file | ||
12 | if [ -f "$HOME"/etc/words/weasels ]; then | ||
13 | wordfile="$HOME/etc/words/weasels" | ||
14 | fi | ||
15 | |||
16 | if [ -f "$WORDSDIR"/weasels ]; then | ||
17 | wordfile="$WORDSDIR/weasels" | ||
18 | fi | ||
19 | |||
20 | if [ -f words/weasels ]; then | ||
21 | wordfile="words/weasels" | ||
22 | fi | ||
23 | |||
24 | if [ ! "$wordfile" = "" ]; then | ||
25 | weasels="xyzabc123" | ||
26 | for w in $(cat $wordfile); do | ||
27 | weasels="$weasels|$w" | ||
28 | done | ||
29 | fi | ||
30 | |||
31 | if [ "$1" = "" ]; then | ||
32 | echo "usage: $(basename "$0") <file> ..." | ||
33 | exit | ||
34 | fi | ||
35 | |||
36 | grep -E -i -n --color "\\b($weasels)\\b" "$*" | ||
37 | |||
38 | exit $? | ||