[ "$1" == "-D" ] && DEBUG=1 && shift 1
DOW=$(date +%a)
TODAY=$(date +%m/%d)
DOM=$(date +%d)
OS=$(uname -s)
NAME=${0##*/}
TOILETF='crop
gay
metal
flip
flop
180
left
right
border'
unset FZF_DEFAULT_OPTS
bl(){
[ "$DEBUG" == "1" ] && set -x
echo ""
}
html(){
vim -f +"syn on" +"set nonu" +"set foldenable!" +"set nospell" +"run! syntax/2html.vim" +"wq" +"q" $1
}
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
}
xtitle(){
printf "\033]0;%s\007" "$*"
}
if [ "$1" == "-E" ]
then
vim $0
sed -i -e "7s/.*/# Updated....: $(date)/" $0
html $0
cp $0 /var/www/unix
mv $0.html /var/www/unix
cp $0 /var/gopher/scripts
exit
fi
if [ "$1" == "-h" ] || [ "$1" == "--help" ]
then
fmt -s -w $(tput cols) <<END
$NAME "{quoted string}"
-b # boxes
-c # cowsay
-f # figlet
-p # punch paper tape
-t # toilet w/ random color effects
Default effect is random.
END
exit
fi
command -v bash >/dev/null || sudo apt install bash -qyy
command -v cowsay >/dev/null || sudo apt install cowsay -yyq
command -v boxes >/dev/null || sudo apt install boxes -yyq
command -v figlet >/dev/null || sudo apt install figlet -yyq
command -v ppt >/dev/null || sudo apt install bsdgames -yyq
command -v toilet >/dev/null || sudo apt install toilet -yyq
[ "$DEBUG" == 1 ] && set -x
case $1 in
-c|0)
CHOICE=$(cowsay -l|grep -v ':'|tr " " "\n" |fzf --layout=reverse --color fg:-1,bg:-1,hl:46,fg+:40,bg+:233,hl+:46 --color prompt:166,border:46 --height 70% --border=sharp --prompt="➤ " )
cowsay -W 63 -f "$CHOICE" "$2"
;;
-b|1)
echo $2|fmt -w 63|boxes -d "$(shuf -n1 ~/etc/boxes-full.txt)"
;;
-f)
figlet -f $(ls /usr/share/figlet/*flf|shuf -n 1) $2
;;
-p)
clear;[ $[RANDOM % 2] = 1 ] && ppt $2 || bcd $2
;;
-t)
toilet -f $(basename $(ls /usr/share/figlet/*flf|shuf -n 1)) -F $(echo "$TOILETF"|shuf -n 1) $2
;;
*)
NUM=$((RANDOM % 4))
case $NUM in
0)
cowsay -W 63 -f $(cowsay -l|grep -v files|tr ' ' '\n' |shuf -n 1) "$1"
;;
1)
echo $1|fmt -w 63|boxes -d "$(shuf -n1 ~/etc/boxes-full.txt)"
;;
2)
figlet -f $(ls /usr/share/figlet/*flf|shuf -n 1) $1
;;
3)
toilet -f $(basename $(ls /usr/share/figlet/*flf|shuf -n 1)) -F $(echo "$TOILETF"|shuf -n 1) $1
;;
esac
esac