aboutsummaryrefslogtreecommitdiff
path: root/src/x_command.sh
diff options
context:
space:
mode:
authorFuwn <[email protected]>2023-07-17 21:41:55 -0700
committerFuwn <[email protected]>2023-07-17 21:41:55 -0700
commit39f48ea3afa3b53ef409e3ca0f6da3d20d16b032 (patch)
treec266a5f8711724f68f657ea54196c1395a94ceef /src/x_command.sh
parentfeat(x): implement social flag for mal (diff)
downloadkaguya-39f48ea3afa3b53ef409e3ca0f6da3d20d16b032.tar.xz
kaguya-39f48ea3afa3b53ef409e3ca0f6da3d20d16b032.zip
fix: shellcheck lints
Diffstat (limited to 'src/x_command.sh')
-rw-r--r--src/x_command.sh24
1 files changed, 12 insertions, 12 deletions
diff --git a/src/x_command.sh b/src/x_command.sh
index 64a2814..67ee42a 100644
--- a/src/x_command.sh
+++ b/src/x_command.sh
@@ -1,13 +1,13 @@
# Default to anime, permit manga
-if [ "${args[--manga]}" = 1 ]; then
+if [[ "${args[--manga]}" = 1 ]]; then
FORMAT="manga"
TYPE="manga"
FILTER="format"
-elif [ "${args[--novel]}" = 1 ]; then
+elif [[ "${args[--novel]}" = 1 ]]; then
FORMAT="novel"
TYPE="manga"
FILTER="format"
-elif [ "${args['--any-manga']}" = 1 ]; then
+elif [[ "${args['--any-manga']}" = 1 ]]; then
FORMAT="manga"
TYPE="manga"
FILTER="type"
@@ -26,23 +26,23 @@ ID=$(curl 'https://graphql.anilist.co/' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--data "{ \"query\": \"{ Media(search: \\\"${TITLE}\\\", \
- ${FILTER}: $(echo ${FORMAT} | tr '[:lower:]' '[:upper:]')) { id idMal } }\" }")
+ ${FILTER}: $(echo "${FORMAT}" | tr '[:lower:]' '[:upper:]' || true)) { id idMal } }\" }")
# Open the anime or manga in AniList by default, permit MyAnimeList
-if [ "${args[--mal]}" = 1 ]; then
- if [ "${args[--social]}" = 1 ]; then
+if [[ "${args[--mal]}" = 1 ]]; then
+ if [[ "${args[--social]}" = 1 ]]; then
FULL_URL=$(curl --silent \
"https://api.jikan.moe/v4/anime/$(echo "${ID}" |
- jq '.data.Media.idMal')/full")
+ jq '.data.Media.idMal')/full" || true)
- xdg-open "$(echo "${FULL_URL}" | jq -r '.data.url')/forum"
+ xdg-open "$(echo "${FULL_URL}" | jq -r '.data.url' || true)/forum"
else
- xdg-open https://myanimelist.net/${TYPE}/"$(echo "${ID}" | jq '.data.Media.idMal')"
+ xdg-open https://myanimelist.net/"${TYPE}"/"$(echo "${ID}" | jq '.data.Media.idMal' || true)"
fi
else
- if [ "${args[--social]}" = 1 ]; then
- xdg-open https://anilist.co/${TYPE}/"$(echo "${ID}" | jq '.data.Media.id')"/social
+ if [[ "${args[--social]}" = 1 ]]; then
+ xdg-open https://anilist.co/"${TYPE}"/"$(echo "${ID}" | jq '.data.Media.id' || true)"/social
else
- xdg-open https://anilist.co/${TYPE}/"$(echo "${ID}" | jq '.data.Media.id')"
+ xdg-open https://anilist.co/"${TYPE}"/"$(echo "${ID}" | jq '.data.Media.id' || true)"
fi
fi