mirror of
https://github.com/danbulant/nekofetch
synced 2026-06-20 14:51:35 +00:00
32 lines
690 B
Bash
Executable file
32 lines
690 B
Bash
Executable file
#!/bin/sh
|
|
|
|
required="neofetch jp2a jq"
|
|
|
|
for req in $required; do
|
|
! command -v "$req" > /dev/null 2>&1 && echo "$req not found!" && exit 1
|
|
done
|
|
|
|
|
|
tmpfile="$(mktemp -p /tmp nekofetchXXXXXXXX)"
|
|
|
|
case "$1" in
|
|
"--nsfw")
|
|
echo "Getting a nsfw image"
|
|
imgurl="https://nekos.life/api/v2/img/cum_jpg"
|
|
;;
|
|
*)
|
|
echo "Getting a sfw image"
|
|
imgurl="https://nekos.life/api/v2/img/neko"
|
|
;;
|
|
esac
|
|
|
|
height=${2:-$(($(tput lines) - 5))}
|
|
echo "Using height $height"
|
|
|
|
url=$(curl -fsSL "$imgurl" | jq -r ".url")
|
|
|
|
curl -fsSLo "$tmpfile.jpg" "$url"
|
|
jp2a --height="$height" "$tmpfile.jpg" > "$tmpfile"
|
|
neofetch --source "$tmpfile"
|
|
|
|
rm "$tmpfile" "$tmpfile.jpg"
|