oizys/utils/rune.sh

33 lines
755 B
Bash
Raw Permalink Normal View History

2023-05-03 16:32:06 -05:00
#! /usr/bin/env nix-shell
#! nix-shell -i bash -p ascii-image-converter
2023-01-19 07:11:16 -06:00
set -e
2023-01-24 12:09:22 -06:00
declare -A IMG_SRC
IMG_SRC=(
[jeran]=https://upload.wikimedia.org/wikipedia/commons/0/01/Runic_letter_jeran.png
[othalan]=https://upload.wikimedia.org/wikipedia/commons/1/16/Runic_letter_othalan.png
2023-05-03 16:32:06 -05:00
[algiz]=https://upload.wikimedia.org/wikipedia/commons/1/14/Runic_letter_algiz.png
2023-01-24 12:09:22 -06:00
)
2023-01-19 07:11:16 -06:00
2023-01-24 12:09:22 -06:00
if [[ $# -eq 0 ]]; then
echo please provide rune name
echo options:
2023-05-03 16:32:06 -05:00
for i in "${!IMG_SRC[@]}"; do
2023-01-24 12:09:22 -06:00
echo $i
done
exit 1
fi
rune=$1
color=${36:-$2}
# tmp this?
2023-01-19 07:11:16 -06:00
FILENAME="Runic_letter_${rune}.png"
2023-01-24 12:09:22 -06:00
2023-07-25 11:07:57 -05:00
[[ -f "$FILENAME" ]] || wget -O "$FILENAME" "${IMG_SRC[$rune]}"
printf "\033[1;%dm\n%s\033[0m\n\n" \
2023-01-19 07:11:16 -06:00
"$color" \
2023-07-25 11:07:57 -05:00
"$(ascii-image-converter "$FILENAME" -n -H 15 -b)" \
2023-01-19 07:11:16 -06:00
>"${rune}.txt"