make DEBUG an environment variable

This commit is contained in:
propruhh 2021-02-28 13:09:27 -06:00
parent df18da99e3
commit 9fe6aca8c2

View file

@ -2,23 +2,21 @@
tmpfile="$(mktemp nekofetchXXXXXXXX)" tmpfile="$(mktemp nekofetchXXXXXXXX)"
debug=true
case "$1" in case "$1" in
"--nsfw"|"nsfw"|"-n"|"n") "--nsfw"|"nsfw"|"-n"|"n")
if [ "$debug" = true ]; then if [ "$DEBUG" = true ]; then
echo "Getting a nsfw image" echo "Getting a nsfw image"
fi fi
imgurl="https://nekos.life/api/v2/img/cum_jpg" imgurl="https://nekos.life/api/v2/img/cum_jpg"
;; ;;
"--sfw"|"sfw"|"-s"|"s") "--sfw"|"sfw"|"-s"|"s")
if [ "$debug" = true ]; then if [ "$DEBUG" = true ]; then
echo "Getting a sfw image" echo "Getting a sfw image"
fi fi
imgurl="https://nekos.life/api/v2/img/neko" imgurl="https://nekos.life/api/v2/img/neko"
;; ;;
*) *)
if [ "$debug" = true ]; then if [ "$DEBUG" = true ]; then
echo "Could not interpret as either sfw or nsfw. Defaulting to sfw." echo "Could not interpret as either sfw or nsfw. Defaulting to sfw."
fi fi
imgurl="https://nekos.life/api/v2/img/neko" imgurl="https://nekos.life/api/v2/img/neko"
@ -26,7 +24,7 @@ case "$1" in
esac esac
echo "$2" | grep -qE '^[0-9]+$' && height="$2" || height="$(($(stty size | awk '{print $1}') - 5))" echo "$2" | grep -qE '^[0-9]+$' && height="$2" || height="$(($(stty size | awk '{print $1}') - 5))"
if [ "$debug" = true ]; then if [ "$DEBUG" = true ]; then
echo "Using height $height" echo "Using height $height"
fi fi