Skip to content

Instantly share code, notes, and snippets.

@williamhammond
Last active September 20, 2018 19:05
Show Gist options
  • Save williamhammond/483a62ae2ba6c12141eb27c4562b7ea6 to your computer and use it in GitHub Desktop.
Save williamhammond/483a62ae2ba6c12141eb27c4562b7ea6 to your computer and use it in GitHub Desktop.
function party {
if ! command -v figlet; then
if ! command -v brew; then
echo Requires figlet or brew to be installed
return 1
fi
brew install figlet
fi
if [ -z "$1" ]; then
echo "Enter party word: "
read PARTY_WORD | tr '[:upper:]' '[:lower:]'
else
PARTY_WORD=$1
fi
if [ -z "$2" ]; then
echo "Enter party word emoji (without colons): "
read WORD_EMOJI
else
WORD_EMOJI=$2
fi
if [ -z "$3" ]; then
echo "Enter background emoji (without colons): "
read BACKGROUND_EMOJI
else
BACKGROUND_EMOJI=$3
fi
echo
figlet -f banner $PARTY_WORD | sed -e "s/#/:$WORD_EMOJI:/g" -e 's/^/ /g' -e "s/ /:$BACKGROUND_EMOJI:/g"
}
@williamhammond
Copy link
Author

credit to dpowell

@daveyarwood
Copy link

I got this working on Ubuntu 16.04 by changing the first part to:

  if ! command -v figlet >/dev/null; then
    if [[ "$(uname)" == Darwin ]]; then
      if ! command -v brew >/dev/null; then
        echo Requires figlet or brew to be installed
        return 1
      fi
      >&2 echo "Installing figlet..."
      brew install figlet
    else
      >&2 echo "Installing figlet..."
      sudo apt-get install figlet
    fi
  fi

Bonus: I redirected command -v figlet and command -v brew STDOUT to /dev/null so that e.g. /usr/bin/figlet doesn't get printed out along with the figlet output, so I can do party foo bar baz | pbcopy to copy the output straight to my clipboard.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment