summaryrefslogtreecommitdiffstats
path: root/.local/bin/weasel
blob: ce82ce3fecd90405c167102c1e4206517c287b0b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/usr/bin/env bash

weasels="many|various|very|fairly|several|extremely\
    |exceedingly|quite|remarkably|few|surprisingly\
    |mostly|largely|huge|tiny|((are|is) a number)\
    |excellent|interestingly|significantly\
    |substantially|clearly|vast|relatively|completely"

wordfile=""

# Check for an alternate weasel file
if [ -f "$HOME"/etc/words/weasels ]; then
    wordfile="$HOME/etc/words/weasels"
fi

if [ -f "$WORDSDIR"/weasels ]; then
    wordfile="$WORDSDIR/weasels"
fi

if [ -f words/weasels ]; then
    wordfile="words/weasels"
fi

if [ ! "$wordfile" = "" ]; then
    weasels="xyzabc123"
    for w in $(cat $wordfile); do
        weasels="$weasels|$w"
    done
fi

if [ "$1" = "" ]; then
    echo "usage: $(basename "$0") <file> ..."
    exit
fi

grep -E -i -n --color "\\b($weasels)\\b" "$*"

exit $?