mirror of
https://github.com/danbulant/nekofetch
synced 2026-07-07 03:51:01 +00:00
Use command-line flags for debug mode (instead of environment variable)
This commit is contained in:
parent
f05516b850
commit
dd64a4d58e
1 changed files with 13 additions and 5 deletions
18
nekofetch
18
nekofetch
|
|
@ -4,9 +4,17 @@ tmpfile="$(mktemp)"
|
||||||
|
|
||||||
while :; do
|
while :; do
|
||||||
case "$1" in
|
case "$1" in
|
||||||
|
"--verbose"|"--debug"|"-v")
|
||||||
|
if [ -z "$debug" ]; then
|
||||||
|
[ "$debug" = "true" ] && echo "Enabling debug output"
|
||||||
|
debug="true"
|
||||||
|
else
|
||||||
|
echo "debug has already been enabled!"
|
||||||
|
fi
|
||||||
|
;;
|
||||||
"--nsfw"|"nsfw"|"-n"|"n")
|
"--nsfw"|"nsfw"|"-n"|"n")
|
||||||
if [ -z "$imgtype" ]; then
|
if [ -z "$imgtype" ]; then
|
||||||
[ "$DEBUG" = "true" ] && echo "Getting a nsfw image"
|
[ "$debug" = "true" ] && echo "Getting a nsfw image"
|
||||||
imgtype="nsfw"
|
imgtype="nsfw"
|
||||||
else
|
else
|
||||||
echo "$imgtype images were already chosen! Please only specify either sfw or nsfw!"
|
echo "$imgtype images were already chosen! Please only specify either sfw or nsfw!"
|
||||||
|
|
@ -14,20 +22,20 @@ while :; do
|
||||||
;;
|
;;
|
||||||
"--sfw"|"sfw"|"-s"|"s")
|
"--sfw"|"sfw"|"-s"|"s")
|
||||||
if [ -z "$imgtype" ]; then
|
if [ -z "$imgtype" ]; then
|
||||||
[ "$DEBUG" = "true" ] && echo "Getting a sfw image"
|
[ "$debug" = "true" ] && echo "Getting a sfw image"
|
||||||
imgtype="sfw"
|
imgtype="sfw"
|
||||||
else
|
else
|
||||||
echo "$imgtype images were already chosen! Please only specify either sfw or nsfw!"
|
echo "$imgtype images were already chosen! Please only specify either sfw or nsfw!"
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
"--w3m"|"w3m"|"--img"|"img"|"-i"|"i")
|
"--w3m"|"w3m"|"--img"|"img"|"-i"|"i")
|
||||||
[ "$DEBUG" = "true" ] && echo "Using w3m image backend for neofetch"
|
[ "$debug" = "true" ] && echo "Using w3m image backend for neofetch"
|
||||||
use_w3m="true"
|
use_w3m="true"
|
||||||
;;
|
;;
|
||||||
"--height"|"-h")
|
"--height"|"-h")
|
||||||
if [ -z "$use_height" ]; then
|
if [ -z "$use_height" ]; then
|
||||||
use_height="$2"
|
use_height="$2"
|
||||||
[ "$DEBUG" = "true" ] && echo "Using height $use_height"
|
[ "$debug" = "true" ] && echo "Using height $use_height"
|
||||||
else
|
else
|
||||||
echo "You can only specify the height argument once!"
|
echo "You can only specify the height argument once!"
|
||||||
fi
|
fi
|
||||||
|
|
@ -56,7 +64,7 @@ else
|
||||||
fi
|
fi
|
||||||
|
|
||||||
url=$(curl -fsSL "$imgurl" | jq -r ".url")
|
url=$(curl -fsSL "$imgurl" | jq -r ".url")
|
||||||
[ "$DEBUG" = "true" ] && echo "Using image at url $url"
|
[ "$debug" = "true" ] && echo "Using image at url $url"
|
||||||
|
|
||||||
curl -fsSLo "$tmpfile.jpg" "$url"
|
curl -fsSLo "$tmpfile.jpg" "$url"
|
||||||
if [ "$TERM" = "xterm-kitty" ]; then
|
if [ "$TERM" = "xterm-kitty" ]; then
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue