#!/usr/bin/env bash
#
# Print the colorized YSAP logo and metadata used as the header for all pages
# you can request via `curl`
#
# Author: Dave Eddy <dave@daveeddy.com>
# Date: March 17, 2024
# License: MIT

. ./colors || exit
. ./tools/repeat-char || exit

padding=1
while getopts 'p:' opt; do
	case "$opt" in
		p) padding=$OPTARG;;
		*) exit 1;;
	esac
done

padding=$(repeat-char ' ' "$padding")

mapfile -t logo < <(./make-logo)

description=(
	""
	"${COLOR5}You Suck at Programming$RST"
	"${COLOR5}Episodes and guide by dave eddy$RST"
	"${COLOR1}https://ysap.sh | https://daveeddy.com$RST"
	''
	"${COLOR5}src: ${COLOR1}https://github.com/bahamas10/ysap$RST"
)

len=${#logo[@]}

for ((i = 0; i < len; i++)); do
	logo_line=${logo[i]}
	desc_line=${description[i]}

	echo "$logo_line$padding$desc_line"
done
