: ' Changes:
Tue Feb 20 2024 Added my master word list ;)
Tue Feb 20 2024 created
'
[ "$1" == "-D" ] && DEBUG=1 && shift 1
[ "$DEBUG" == 1 ] && echo "---Variables---" && set -x
PS4='$SECONDS $LINENO: '
DOW=$(date +%a)
TODAY=$(date +%m/%d)
DOM=$(date +%d)
OS=$(uname -s)
NAME=${0##*/}
DIR="$(basename $PWD)"
PDIR="$(cd ..;basename $PWD)"
export FZF_DEFAULT_OPTS="--ansi "
R=$(tput setaf 1)
BR=$(tput setaf 1; tput bold)
G=$(tput setaf 2)
BG=$(tput setaf 2; tput bold)
Y=$(tput setaf 3)
BY=$(tput setaf 3; tput bold)
B=$(tput setaf 4)
BM=$(tput setaf 5; tput bold)
BC=$(tput setaf 6; tput bold)
C=$(tput setaf 6)
BL=$(tput setaf 7; tput bold)
BLD=$(tput bold)
N=$(tput sgr0)
SIT=$(tput sitm)
RIT=$(tput ritm)
UL=$(tput smul)
NL=$(tput rmul)
RV=$(tput rev)
ROWS=$(tput lines)
COLS=$(tput cols)
[ "$DEBUG" == 1 ] && set +x && read -p "${N}-Continue-" -n 1 x
bl(){
[ "$DEBUG" == "1" ] && set -x
echo ""
}
html(){
vim -f +"syn on" +"set nonu" +"set foldenable!" +"set nospell" +"run! syntax/2html.vim" +"wq" +"q" $1
}
log(){
[ "$DEBUG" == "1" ] && set -x
logger -i -t "$NAME" "$*"
}
pause(){
[ "$DEBUG" == "1" ] && set -x
[ "$1" == "-nt" ] && TMOUT="" && shift
echo "$BY";
if [ $# -gt 0 ]
then
read -t $1 -r -p "${C}Hit any key (${BY}$1${C} second timeout)${N}" -n 1 FOO;
else
read -r -p "${C}Hit any key${N}" -n 1 FOO;
fi;
bl
}
strip-tags(){
sed -e 's/<[^>]*.//g' -
}
xtitle(){
printf "\033]0;%s\007" "$*"
}
version(){
grep -E '^# Updated' $0
bl
sed -n "/' Changes/,/^ *$/p" <$0 |grep -E -v 'sed -n|exit 0|}'
exit 0
}
version(){
grep -E '^# Updated' $0
bl
sed -n "/' Changes/,/^ *$/p" <$0 |grep -E -v 'sed -n|exit 0|}'
exit 0
}
if [ "$1" == "-E" ]
then
vim $0
sed -i -e "7s/.*/# Updated....: $(date)/" $0
log "Updated $0"
html $0
cp $0 /var/www/unix
mv $0.html /var/www/unix
cp $0 /var/gopher/bin
exit
fi
if [ "$1" == "-h" ] || [ "$1" == "--help" ]
then
fmt -s -w $(tput cols) <<END
$NAME
{word}
If no word is provided, then a fuzzy search will commence.
END
exit
fi
if [ "$1" == "-v" ] || [ "$1" == "--version" ]
then
version
fi
command -v fzf >/dev/null || sudo apt install fzf -yyq
command -v dict >/dev/null || sudo apt install dict -qyy
[ "$DEBUG" == 1 ] && echo "---Functions---" && typeset -F && read -p "${N}-Continue-" -n 1 x
[ "$DEBUG" == 1 ] && echo "---Main---" && set -x
xtitle Lookup;
if [ $# -eq 0 ]
then
WORD=$(cat ~/etc/words-alpha.txt | fzf --ansi --reverse --color fg:-1,bg:-1,hl:46,fg+:40,bg+:233,hl+:46 --color prompt:166,border:46 --height 70% --border=sharp --prompt="➤ " --pointer="➤ " --marker="➤ ")
else
WORD=$1
fi
[ "$WORD" == "q" -o "$WORD" == "Q" ] && exit
LNO=$(grep -in ".\*$WORD\*" /home/mitch/Documents/faith/ref/wole.txt| cut -d: -f1)
if [ -n "$LNO" ]
then
vim -c "set nonu" -c "set ft=txt" -c "set nospell " -c 'runtime! macros/less.vim' +"${LNO}" /home/mitch/Documents/faith/ref/wole.txt
fi
dict -hv mitch-laptop.home "$WORD" > /tmp/$$.txt || exit
vim -c "set nonu" -c "set ft=txt" -c "set nospell" -c 'runtime! macros/less.vim' /tmp/$$.txt;
rm /tmp/$$.txt;