aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/bashly.yml4
-rw-r--r--src/x_command.sh12
2 files changed, 16 insertions, 0 deletions
diff --git a/src/bashly.yml b/src/bashly.yml
index 2a83181..c3f106a 100644
--- a/src/bashly.yml
+++ b/src/bashly.yml
@@ -75,5 +75,9 @@ commands:
- long: --mal
conflicts: [--al]
+ - long: --both
+ short: -b
+ conflicts: [--al --mal]
+
- long: --social
short: -s
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