2021-03-13 10:34:45 -05:00
|
|
|
#!/bin/sh
|
|
|
|
|
2021-03-13 11:13:33 -05:00
|
|
|
cyan=$(tput setaf 6)
|
|
|
|
red=$(tput setaf 1)
|
|
|
|
bold=$(tput bold)
|
|
|
|
underline=$(tput smul)
|
|
|
|
esc=$(tput sgr0)
|
|
|
|
|
2021-03-13 10:34:45 -05:00
|
|
|
if [ -z "$1" ]; then
|
2021-05-17 15:26:39 -04:00
|
|
|
fzf --no-multi < /usr/share/dict/words | xargs -t -r dict
|
2021-03-13 10:34:45 -05:00
|
|
|
else
|
2021-03-13 11:13:33 -05:00
|
|
|
curl -s "dict://dict.org/d:$1" | sed -n -e '/^151.*/,/^\./p' | sed -e 's/^151.*//g' -e '/^\./D' -e '/^\s*1\./i\\' -e "s/{\([^{]*\)}/${esc}${bold}${underline}\1${esc}/g" -e "s/^\($1\)\(\W\)/${esc}${bold}${red}\1${esc}\2/gI" -e "s/^\(\s*\)\([0-9]\.\)/\1${esc}${bold}${cyan}\2${esc}/g" -e 's/--/—/g' -e 's/—\(\w\)/— \1/g'
|
2021-03-13 10:34:45 -05:00
|
|
|
fi
|