commit 8328cb5c541a961a6c907524fd9f7b805f43c228
parent c7711267544f77d1fcac13d800c47f9d3ab7c20e
Author: Jacob R. Edwards <jacobouno@protonmail.com>
Date: Wed, 18 Nov 2020 22:58:43 -0800
Update thesaurus variable and walt script
Thesaurus varible (now THESAURUS_DIR) points to a directory containing
an alphabetically split Moby Thesaurus.
Diffstat:
2 files changed, 15 insertions(+), 7 deletions(-)
diff --git a/modules/profile/.profile b/modules/profile/.profile
@@ -20,7 +20,7 @@ export DICT_DIR="$HOME/.local/share/wdef"
export FEED_DIR="$HOME/.local/var/rss"
export PWDLOG="$HOME/.local/var/pwd.log"
export SCREENSHOT_DIR="$HOME/own/image/screenshots"
-export THESAURUS="$HOME/.local/share/walt/moby-thesaurus"
+export THESAURUS_DIR="$HOME/.local/share/walt/"
export URL_DIR="$HOME/.local/var/bookmarks"
export WALLPAPER_DIR="$HOME/image/wallpapers"
diff --git a/modules/scripts/.local/bin/walt b/modules/scripts/.local/bin/walt
@@ -1,9 +1,17 @@
-#!/usr/bin/env dash
-# thesaurus search utility.
+#!/usr/local/bin/rc -e
+# Moby Thesaurus search utility.
-# pipe throught rs(1) for pretty formating. i.e.:
-# $ get word | rs
+# For an alphabetically split Moby Thesaurus csv file see my
+# ``cvsmoby'' repository.
-get() { grep -m1 "^${1:?No word.}," "${THESAURUS:?unset}" ;}
+fn match { grep -m1 '^'^$word^',' $* }
-get "$1" | tr ',' '\n'
+for (word in $*) {
+ l = `{ dd 'bs=1' 'count=1' >[2] /dev/null <<< $word }
+ match $THESAURUS_DIR/$l.csv | cut -d, -f2- | tr ',' '\n' || {
+ # assumes grep error.
+ if (test $status(1) -ne 1)
+ exit
+ printf '%s: ''%s'': Word not found.\n' `{ basename $0 } $word >[1=2]
+ }
+}