mirror of
https://github.com/danbulant/nekofetch
synced 2026-07-03 01:50:51 +00:00
Use a case statement for argument parsing
This commit is contained in:
parent
c6e1f07bbe
commit
0a8bbb0c2d
1 changed files with 12 additions and 5 deletions
17
nekofetch
17
nekofetch
|
|
@ -9,11 +9,18 @@ done
|
||||||
|
|
||||||
tmpfile="$(mktemp -p /tmp nekofetchXXXXXXXX)"
|
tmpfile="$(mktemp -p /tmp nekofetchXXXXXXXX)"
|
||||||
|
|
||||||
if [ "$1" = "--nsfw" ]; then
|
case "$1" in
|
||||||
url=$(curl -fsSL "https://nekos.life/api/v2/img/cum_jpg" | jq -r ".url")
|
"--nsfw")
|
||||||
else
|
echo "Getting a nsfw image"
|
||||||
url=$(curl -fsSL "https://nekos.life/api/v2/img/neko" | jq -r ".url")
|
imgurl="https://nekos.life/api/v2/img/cum_jpg"
|
||||||
fi
|
;;
|
||||||
|
*)
|
||||||
|
echo "Getting a sfw image"
|
||||||
|
imgurl="https://nekos.life/api/v2/img/neko"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
url=$(curl -fsSL "$imgurl" | jq -r ".url")
|
||||||
|
|
||||||
curl -fsSLo "$tmpfile.jpg" "$url"
|
curl -fsSLo "$tmpfile.jpg" "$url"
|
||||||
jp2a "$tmpfile.jpg" > "$tmpfile"
|
jp2a "$tmpfile.jpg" > "$tmpfile"
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue