diff options
author | Yigit Sever | 2021-11-04 12:25:04 +0300 |
---|---|---|
committer | Yigit Sever | 2021-11-04 12:25:04 +0300 |
commit | a0bb023d782dd2d8703670d560b5ccd8d25d640e (patch) | |
tree | 1c11a649e2201e1458c4011894086f49da5ded15 /.local/bin/weasel | |
parent | 93cdb13eada4e803fb4db71fb581d9e4a03d2119 (diff) | |
download | dotfiles-a0bb023d782dd2d8703670d560b5ccd8d25d640e.tar.gz dotfiles-a0bb023d782dd2d8703670d560b5ccd8d25d640e.tar.bz2 dotfiles-a0bb023d782dd2d8703670d560b5ccd8d25d640e.zip |
bins: shfmt, weasel suite, spark
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 $? | ||