#!/bin/sh tmpfile="$(mktemp nekofetchXXXXXXXX)" debug=false case "$1" in "--nsfw"|"nsfw"|"-n"|"n") if [ "$debug" == true ]; then echo "Getting a nsfw image" fi imgurl="https://nekos.life/api/v2/img/cum_jpg" ;; "--sfw"|"sfw"|"-s"|"s") if [ "$debug" == true ]; then echo "Getting a sfw image" fi imgurl="https://nekos.life/api/v2/img/neko" ;; *) if [ "$debug" == true ]; then echo "Could not interpret as either sfw or nsfw. Defaulting to sfw." fi imgurl="https://nekos.life/api/v2/img/neko" ;; esac echo "$2" | grep -qE '^[0-9]+$' && height="$2" || height="$(($(stty size | awk '{print $1}') - 5))" if [ "$debug" == true ]; then echo "Using height $height" fi url=$(curl -fsSL "$imgurl" | jq -r ".url") curl -fsSLo "$tmpfile.jpg" "$url" if [ "$TERM" = "xterm-kitty" ]; then neofetch --kitty "$tmpfile.jpg" else jp2a --height="$height" "$tmpfile.jpg" > "$tmpfile" neofetch --source "$tmpfile" fi rm "$tmpfile" "$tmpfile.jpg"