#!/bin/bash API_KEY=x PRIV_KEY=x TS=1 HASH=$(echo -n ${TS}${PRIV_KEY}${API_KEY} | md5sum | cut -d ' ' -f 1) echo -e "what do you want to look up? \n" CHOOSE=$(gum choose --limit 1 "characters" "comics" "creators") echo -e "what do you want to look up from ${CHOOSE}? \n" LOOK=$(gum input --placeholder "type away") URL="https://gateway.marvel.com/v1/public/${CHOOSE}?${TYPE}=${LOOK}&apikey=${API_KEY}&ts=${TS}&hash=${HASH}" if [ "${CHOOSE}" == "characters" ]; then echo -e "pick from below \n" TYPE="name" CHARA=$(gum choose --limit 1 "comics" "series" "events") case ${CHARA} in comics) echo -n -e "comics starring ${LOOK}: \n\n" curl -s ${URL} | jq -r ".data.results[].comics.items[].name" ;; series) echo -n -e "series starring ${LOOK}: \n\n" curl -s ${URL} | jq -r ".data.results[].series.items[].name" ;; events) echo -n -e "events starring ${LOOK}: \n\n" curl -s ${URL} | jq -r ".data.results[].events.items[].name" ;; esac elif [ "$CHOOSE" == "comics" ]; then echo -e "pick from below \n" TYPE="title" COMIC=$(gum choose --limit 1 "title" "description") case ${COMIC} in title) echo -n -e "comics featuring ${LOOK}: \n\n" curl -s ${URL} | jq -r ".data.results[].title" ;; description) echo -n -e "comic descriptions with ${LOOK}: \n\n" curl -s ${URL} | jq -r ".data.results[].description" ;; esac else echo -e "did you hit ctrl+c" fi