Skip to content
164 changes: 119 additions & 45 deletions custom-completions/ani-cli/ani-cli-completions.nu
Original file line number Diff line number Diff line change
@@ -1,51 +1,125 @@
# author: HirschBerge
# inspired by DWTW
# Custom completions for ani-cli 4.10.0

def videoQuality [] {
[ "worst", "360p", "480p", "720p", "1080p", "4K", "best" ]
const qualities = [
best
worst
'360'
'480'
'720'
'1080'
]

const limit = 24

def qualities [] { {
options: { sort: false }
completions: $qualities
} }

def episodes [] { {
options: { sort: false }
completions: (1..$limit | into string)
} }

def ranges [] { {
options: { sort: false }
completions: (
1..$limit | each {
|start| $start..$limit | each {
|end| if $start != $end {
$'($start)-($end)'
}
}
} | flatten
)
} }

# Watch anime from the commandline.
#
# A shell script to browse and search anime from the command-line.
# This tool scrapes the site allanime.
# ani-cli without options defaults to iina on macOS, flatpak mpv on Steamdeck,
# mpv apk on android, vlc on iOS and mpv media player everywhere else.
@search-terms anime
@category network
@example "Search for 'banana fish' in 720p" {
ani-cli -q 720 banana fish
}
@example "Search for 'one piece', select 2nd entry and skip the intro" {
ani-cli --skip --skip-title "one piece" -S 2 one piece
}
def common_episodes [] {
[ "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13" ]
@example "Search for 'cyberpunk edgerunners' and download 2nd episode" {
ani-cli -d -e 2 cyberpunk edgerunners
}
def common_ranges [] {
[ "1-5", "5-10", "1-13", "14-26", "1-26" ]
@example "Search for 'cyberpunk edgerunners' 4th episode with VLC in 1080p" {
ani-cli --vlc cyberpunk edgerunners -q 1080 -e 4
}
@example "Search for 'blue lock' 5th and 6th episodes" {
ani-cli blue lock -e 5-6
}
@example "Search for 'blue lock' 5th and 6th episodes" {
ani-cli -e "5 6" blue lock
}
export extern ani-cli [
...query: string

--quality (-q): string@qualities
# Specify the video quality

--episode (-e): string@episodes
# Specify the episode number to watch

--range (-r): string@ranges
# Specify the episode numbers to watch

--select-nth (-S): int
# Selects nth entry

--skip-title: string
# Use given title as ani-skip query

--syncplay (-s)
# Use Syncplay to watch with friends (mpv only)

--download (-d)
# Download the video instead of playing it

--continue (-c)
# Continue watching from history

--help (-h)
# Show summary of options

--delete (-D)
# Delete history

--logview (-l)
# Show logs

--update (-U)
# Update the script

--version (-V)
# Show the version of the script

--nextep-countdown (-N)
# Display a countdown to the next episode

--vlc (-v)
# Use VLC as the media player

--skip
# Use ani-skip to skip the intro of the episode (mpv only)

--dub
# Play the dubbed version

--rofi
# Use rofi instead of fzf for the interactive menu

--no-detach
# Don't detach the player (mpv only)

# Anime Search and Streaming Tool
export extern "ani-cli" [
string?
-q: int@videoQuality # Specify video quality
--quality: int@videoQuality # Specify video quality
-s # Use Syncplay to watch with friends
--syncplay # Use Syncplay to watch with friends
-f # Use FZF for selection
--fzf # Use FZF for selection
-e: string@common_episodes # Specify episode number
--episode: string@common_episodes # Specify episode number
-d # Download the episode instead of playing it
--download # Download the episode instead of playing it
-p # Download episode to a specified directory
--path: string # Download episode to a specified directory
-c # Continue watching from history
--continue # Continue watching from history
-h # Show help text
--help # Show help text
-D # Delete history
--delete # Delete history
-l # Show logs
--log-view # Show logs
-U # Update the script
--update # Update the script
-V # Show the version of the script
--version # Show the version of the script
-r: string@common_ranges # Specify range number
--range: string@common_ranges # Specify range number
--skip # Use ani-skip to skip intros (mpv only)
--dub # Play dubbed version
--rofi # Use rofi instead of fzf for menu
--no-detach # Don't detach the player (mpv only)
--exit-after-play # Exit after playing (mpv only)
--skip-title: string # Use the given title for ani-skip query
-N # Display a countdown to the next episode
--nextep-countdown # Display a countdown to the next episode
--exit-after-play
# Exit after playing, and return player exit code (mpv only)
]