#!/usr/bin/bash SHARE_DIR="${HOME}/.local/share" FONT_REPO="https://github.com/xero/figlet-fonts" FONT_DIR="${SHARE_DIR}/xero-figlet-fonts" function sanity_check() { if ! command -v figlet > /dev/null; then echo "Error: Missing command: figlet" echo " No point doing more." exit 1 fi if [ ! -d $FONT_DIR ]; then clone_font_dir fi figlet "zip zap" echo "New fonts are available in $FONT_DIR" sleep 1 } function clone_font_dir() { if ! command -v git > /dev/null; then echo "Error: Unable to clone font source" echo " Missing command: git" echo " Fix that and try again" exit 1 fi if [ ! -d $SHARE_DIR ]; then mkdir -p $SHARE_DIR if [ $? -ne 0 ]; then echo "Error: Unable to create SHARE_DIR=$SHARE_DIR" echo " A head scratcher indeed." exit 1 fi fi if [ ! -d $FONT_DIR ]; then cmd="git clone ${FONT_REPO} ${FONT_DIR}" echo $cmd; sleep 1 $cmd if [ $? -ne 0 ]; then echo "Error: Unable to clone ${FONT_REPO} into ${FONT_DIR}" exit 1 fi fi } sanity_check function installed_fonts() { echo "TODO" } function new_fonts() { echo "TODO" } function cheese_lab() { sleep 1 if command -v lolcat > /dev/null; then echo;figlet -c -d ~/.local/share/xero-figlet-fonts -f 3d CHEESE lab | lolcat -a; echo else echo;figlet -c -d ~/.local/share/xero-figlet-fonts -f 3d CHEESE lab ; echo fi } cheese_lab