diff options
| author | Fuwn <[email protected]> | 2023-07-15 22:17:16 -0700 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2023-07-15 22:17:16 -0700 |
| commit | 1ac201cb70b937c84a4af6b81c6c394dc5040991 (patch) | |
| tree | f265e7e2358ec1143d731e5d85baa4b49efc2e1f | |
| parent | feat: initial release (diff) | |
| download | kaguya-1ac201cb70b937c84a4af6b81c6c394dc5040991.tar.xz kaguya-1ac201cb70b937c84a4af6b81c6c394dc5040991.zip | |
feat(x): more filter options
| -rw-r--r-- | src/bashly.yml | 15 | ||||
| -rw-r--r-- | src/x_command.sh | 14 |
2 files changed, 25 insertions, 4 deletions
diff --git a/src/bashly.yml b/src/bashly.yml index 3a0882b..dd0f0ff 100644 --- a/src/bashly.yml +++ b/src/bashly.yml @@ -35,11 +35,20 @@ commands: repeatable: true flags: - - long: --anime - conflicts: [--manga] + - long: --tv + conflicts: [--manga --novel] - long: --manga - conflicts: [--anime] + conflicts: [--tv --novel] + + - long: --novel + conflicts: [--tv --manga] + + - long: --any-tv + conflicts: [--tv --manga --novel --any-manga] + + - long: --any-manga + conflicts: [--tv --manga --novel --any-tv] - long: --al conflicts: [--mal] diff --git a/src/x_command.sh b/src/x_command.sh index 4150cdb..25d1622 100644 --- a/src/x_command.sh +++ b/src/x_command.sh @@ -1,8 +1,20 @@ # Default to anime, permit manga if [ "${args[--manga]}" = 1 ]; then + FORMAT="manga" TYPE="manga" + FILTER="format" +elif [ "${args[--novel]}" = 1 ]; then + FORMAT="novel" + TYPE="manga" + FILTER="format" +elif [ "${args['--any-manga']}" = 1 ]; then + FORMAT="manga" + TYPE="manga" + FILTER="type" else + FORMAT="tv" TYPE="anime" + FILTER="format" fi TITLE=$(array_to_string "${args[title]}") @@ -14,7 +26,7 @@ ID=$(curl 'https://graphql.anilist.co/' \ --header 'Content-Type: application/json' \ --header 'Accept: application/json' \ --data "{ \"query\": \"{ Media(search: \\\"${TITLE}\\\", \ - type: $(echo ${TYPE} | tr '[:lower:]' '[:upper:]')) { id idMal } }\" }") + ${FILTER}: $(echo ${FORMAT} | tr '[:lower:]' '[:upper:]')) { id idMal } }\" }") # Open the anime or manga in AniList by default, permit MyAnimeList if [ "${args[--mal]}" = 1 ]; then |