diff options
| author | Fuwn <[email protected]> | 2023-07-17 21:41:55 -0700 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2023-07-17 21:41:55 -0700 |
| commit | 39f48ea3afa3b53ef409e3ca0f6da3d20d16b032 (patch) | |
| tree | c266a5f8711724f68f657ea54196c1395a94ceef /src | |
| parent | feat(x): implement social flag for mal (diff) | |
| download | kaguya-39f48ea3afa3b53ef409e3ca0f6da3d20d16b032.tar.xz kaguya-39f48ea3afa3b53ef409e3ca0f6da3d20d16b032.zip | |
fix: shellcheck lints
Diffstat (limited to 'src')
| -rw-r--r-- | src/anilist_command.sh | 2 | ||||
| -rw-r--r-- | src/crunchyroll_command.sh | 4 | ||||
| -rw-r--r-- | src/hidive_command.sh | 4 | ||||
| -rw-r--r-- | src/myanimelist_command.sh | 2 | ||||
| -rw-r--r-- | src/watch_command.sh | 6 | ||||
| -rw-r--r-- | src/x_command.sh | 24 |
6 files changed, 21 insertions, 21 deletions
diff --git a/src/anilist_command.sh b/src/anilist_command.sh index 40e5018..39e602d 100644 --- a/src/anilist_command.sh +++ b/src/anilist_command.sh @@ -1,4 +1,4 @@ -if [ -n "${args[profile]}" ]; then +if [[ -n "${args[profile]}" ]]; then xdg-open https://anilist.co/user/"${args[profile]}" else xdg-open https://anilist.co/home diff --git a/src/crunchyroll_command.sh b/src/crunchyroll_command.sh index c80bcf6..8a8fd8d 100644 --- a/src/crunchyroll_command.sh +++ b/src/crunchyroll_command.sh @@ -1,5 +1,5 @@ -if [ -n "${args[search]}" ]; then - xdg-open https://www.crunchyroll.com/search?q="$(array_to_string "${args[search]}")" +if [[ -n "${args[search]}" ]]; then + xdg-open https://www.crunchyroll.com/search?q="$(array_to_string "${args[search]}" || true)" else xdg-open https://www.crunchyroll.com/ fi diff --git a/src/hidive_command.sh b/src/hidive_command.sh index d3025df..990ddee 100644 --- a/src/hidive_command.sh +++ b/src/hidive_command.sh @@ -1,5 +1,5 @@ -if [ -n "${args[search]}" ]; then - xdg-open https://www.hidive.com/search?q="$(array_to_string "${args[search]}")" +if [[ -n "${args[search]}" ]]; then + xdg-open https://www.hidive.com/search?q="$(array_to_string "${args[search]}" || true)" else xdg-open https://www.hidive.com/ fi diff --git a/src/myanimelist_command.sh b/src/myanimelist_command.sh index e372c04..3b55820 100644 --- a/src/myanimelist_command.sh +++ b/src/myanimelist_command.sh @@ -1,4 +1,4 @@ -if [ -n "${args[profile]}" ]; then +if [[ -n "${args[profile]}" ]]; then xdg-open https://myanimelist.net/profile/"${args[profile]}" else xdg-open https://myanimelist.net diff --git a/src/watch_command.sh b/src/watch_command.sh index 9fd039d..137bb0f 100644 --- a/src/watch_command.sh +++ b/src/watch_command.sh @@ -1,5 +1,5 @@ -if [ -n "${args[--dub]}" ]; then - ani-cli --dub "$(array_to_string "${args[search]}")" +if [[ -n "${args[--dub]}" ]]; then + ani-cli --dub "$(array_to_string "${args[search]}" || true)" else - ani-cli "$(array_to_string "${args[search]}")" + ani-cli "$(array_to_string "${args[search]}" || true)" fi 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 |