Skip to content

Instantly share code, notes, and snippets.

@dayne
Last active September 22, 2024 23:53
Show Gist options
  • Save dayne/1fc68966829c961deb9edc6b8c759853 to your computer and use it in GitHub Desktop.
Save dayne/1fc68966829c961deb9edc6b8c759853 to your computer and use it in GitHub Desktop.
figlet font installer

figlet font installer

Cause why not?

https://github.com/xero/figlet-fonts

Tasks

Hello World

if [ ! -d $HOME/gists ]; then
    mkdir $HOME/gists
fi
cd $HOME/gists

if [ ! -d gist-dayne-figfont ]; then
    git clone [email protected]:1fc68966829c961deb9edc6b8c759853.git gist-dayne-figfont
fi
cd gist-dayne-figfont
./zap.sh
#!/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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment