aboutsummaryrefslogtreecommitdiff
path: root/src/x_command.sh
diff options
context:
space:
mode:
authorFuwn <[email protected]>2023-07-17 21:44:55 -0700
committerFuwn <[email protected]>2023-07-17 21:44:55 -0700
commitb729fcd4756fb9bd8904f4a5888cd84e6c3823de (patch)
tree7d6e7a35ec47d99b9928f89416aa576e787be983 /src/x_command.sh
parentfix: shellcheck lints (diff)
downloadkaguya-b729fcd4756fb9bd8904f4a5888cd84e6c3823de.tar.xz
kaguya-b729fcd4756fb9bd8904f4a5888cd84e6c3823de.zip
feat(x): open both flag
Diffstat (limited to 'src/x_command.sh')
-rw-r--r--src/x_command.sh12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/x_command.sh b/src/x_command.sh
index 67ee42a..9e6e297 100644
--- a/src/x_command.sh
+++ b/src/x_command.sh
@@ -39,6 +39,18 @@ if [[ "${args[--mal]}" = 1 ]]; then
else
xdg-open https://myanimelist.net/"${TYPE}"/"$(echo "${ID}" | jq '.data.Media.idMal' || true)"
fi
+elif [[ "${args[--both]}" = 1 ]]; then
+ if [[ "${args[--social]}" = 1 ]]; then
+ FULL_URL=$(curl --silent \
+ "https://api.jikan.moe/v4/anime/$(echo "${ID}" |
+ jq '.data.Media.idMal')/full" || true)
+
+ xdg-open https://anilist.co/"${TYPE}"/"$(echo "${ID}" | jq '.data.Media.id' || true)"/social
+ xdg-open "$(echo "${FULL_URL}" | jq -r '.data.url' || true)/forum"
+ else
+ xdg-open https://anilist.co/"${TYPE}"/"$(echo "${ID}" | jq '.data.Media.id' || true)"
+ 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' || true)"/social