#!/usr/bin/env bash
set -euo pipefail

COLOR_CYAN='\033[1;36m'
COLOR_DEFAULT='\033[0m'

function main() {
  parse_args ${@}
}

function parse_args() {
  for var in $@
  do
    if [ "${1-default}" = "--dev" ]; then
      install_dev
    fi
  done
}

function install_dev(){
  echo "Installing Developer Setup"
  ansible-playbook -K ansible/dev.yml
  yarn
  yarn format
  print_finished
}

# Print that we're finished.
function print_finished(){
echo "~~~~~~~~~~~~~~ PUFFIN INSTALLED ~~~~~~~~~~~~~"

# Flair
echo -e "${COLOR_CYAN}
                       .-\"-.
                      /  ,~a\_
                      \  \__))>
                      ,) .\" \\
                     /  (    \\
                    /   )    ;
                ^_ /   /     /
                \,/_.\"\`  _.-\`
                  /_/\`\"\\___
                       \`~~~\`

                 .d888 .d888d8b
                d88P\" d88P\" Y8P
                888   888
88888b. 888  88888888888888888888888b.
888 \"88b888  888888   888   888888 \"88b
888  888888  888888   888   888888  888
888 d88PY88b 888888   888   888888  888
88888P\"  \"Y88888888   888   888888  888
888
888
888
${COLOR_DEFAULT}"
}

main "${@:1}"
