From 39f48ea3afa3b53ef409e3ca0f6da3d20d16b032 Mon Sep 17 00:00:00 2001 From: Fuwn Date: Mon, 17 Jul 2023 21:41:55 -0700 Subject: fix: shellcheck lints --- src/x_command.sh | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'src/x_command.sh') 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 -- cgit v1.2.3