mirror of
https://github.com/danbulant/nekofetch
synced 2026-07-07 12:00:43 +00:00
Add custom type support
Adds the ability to set custom types
This commit is contained in:
parent
5762eafd73
commit
b59c711ac5
1 changed files with 24 additions and 6 deletions
30
nekofetch
30
nekofetch
|
|
@ -3,11 +3,12 @@
|
||||||
tmpfile="$(mktemp)"
|
tmpfile="$(mktemp)"
|
||||||
|
|
||||||
while :; do
|
while :; do
|
||||||
|
|
||||||
case "$1" in
|
case "$1" in
|
||||||
"--verbose"|"--debug"|"-v")
|
"--verbose"|"--debug"|"-v")
|
||||||
if [ -z "$debug" ]; then
|
if [ -z "$debug" ]; then
|
||||||
[ "$debug" = "true" ] && echo "Enabling debug output"
|
|
||||||
debug="true"
|
debug="true"
|
||||||
|
[ "$debug" = "true" ] && echo "Enabling debug output"
|
||||||
else
|
else
|
||||||
echo "debug has already been enabled!"
|
echo "debug has already been enabled!"
|
||||||
fi
|
fi
|
||||||
|
|
@ -38,7 +39,7 @@ while :; do
|
||||||
[ "$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 type, sfw or nsfw!"
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
|
@ -47,7 +48,15 @@ while :; do
|
||||||
[ "$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 type, sfw or nsfw!"
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
|
||||||
|
"--type"|"-t")
|
||||||
|
if [ -z "$imgtype" ]; then
|
||||||
|
imgtype="__ask"
|
||||||
|
else
|
||||||
|
echo "$imgtype images were already chosen! Please only specify either type, sfw or nsfw!"
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
|
@ -69,8 +78,11 @@ while :; do
|
||||||
*)
|
*)
|
||||||
if [ -z "$1" ]; then
|
if [ -z "$1" ]; then
|
||||||
break
|
break
|
||||||
|
elif [ "$imgtype" = "__ask" ]; then
|
||||||
|
imgtype="$1"
|
||||||
|
else
|
||||||
|
echo "Could not interpret parameter '$1'."
|
||||||
fi
|
fi
|
||||||
echo "Could not interpret parameter '$1'."
|
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
shift
|
shift
|
||||||
|
|
@ -87,8 +99,10 @@ fi
|
||||||
if [ ! "$offline" = "true" ]; then
|
if [ ! "$offline" = "true" ]; then
|
||||||
if [ "$imgtype" = "nsfw" ]; then
|
if [ "$imgtype" = "nsfw" ]; then
|
||||||
imgurl="https://nekos.life/api/v2/img/cum_jpg"
|
imgurl="https://nekos.life/api/v2/img/cum_jpg"
|
||||||
else
|
elif [ "$imgtype" = "sfw" ] || [ -z "$imgtype" ]; then
|
||||||
imgurl="https://nekos.life/api/v2/img/neko"
|
imgurl="https://nekos.life/api/v2/img/neko"
|
||||||
|
else
|
||||||
|
imgurl="https://nekos.life/api/v2/img/$imgtype"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
@ -121,7 +135,11 @@ elif [ "$use_w3m" = "true" ]; then
|
||||||
neofetch --w3m "$tmpfile.jpg"
|
neofetch --w3m "$tmpfile.jpg"
|
||||||
|
|
||||||
else
|
else
|
||||||
jp2a --height="$height" "$tmpfile.jpg" > "$tmpfile"
|
if [ -z "$colors" ]; then
|
||||||
|
jp2a --height="$height" "$tmpfile.jpg" > "$tmpfile"
|
||||||
|
else
|
||||||
|
jp2a --height="$height" --colors "$tmpfile.jpg" > "$tmpfile"
|
||||||
|
fi
|
||||||
neofetch --source "$tmpfile"
|
neofetch --source "$tmpfile"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue