Skip to content

Commit f7af068

Browse files
authored
feat: ani-cli completions rework (#1149)
most of the changes are in the commit descriptions, but briefly it just a rework of ani-cli completions. there were some outdated (or just non-existent from the start) parameters, some errors and i didn't like the styling. while at it, i added more functionality to the completions, examples and remaining options.
1 parent 4e39ed3 commit f7af068

File tree

1 file changed

+119
-45
lines changed

1 file changed

+119
-45
lines changed
Lines changed: 119 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,125 @@
1-
# author: HirschBerge
2-
# inspired by DWTW
1+
# Custom completions for ani-cli 4.10.0
32

4-
def videoQuality [] {
5-
[ "worst", "360p", "480p", "720p", "1080p", "4K", "best" ]
3+
const qualities = [
4+
best
5+
worst
6+
'360'
7+
'480'
8+
'720'
9+
'1080'
10+
]
11+
12+
const limit = 24
13+
14+
def qualities [] { {
15+
options: { sort: false }
16+
completions: $qualities
17+
} }
18+
19+
def episodes [] { {
20+
options: { sort: false }
21+
completions: (1..$limit | into string)
22+
} }
23+
24+
def ranges [] { {
25+
options: { sort: false }
26+
completions: (
27+
1..$limit | each {
28+
|start| $start..$limit | each {
29+
|end| if $start != $end {
30+
$'($start)-($end)'
31+
}
32+
}
33+
} | flatten
34+
)
35+
} }
36+
37+
# Watch anime from the commandline.
38+
#
39+
# A shell script to browse and search anime from the command-line.
40+
# This tool scrapes the site allanime.
41+
# ani-cli without options defaults to iina on macOS, flatpak mpv on Steamdeck,
42+
# mpv apk on android, vlc on iOS and mpv media player everywhere else.
43+
@search-terms anime
44+
@category network
45+
@example "Search for 'banana fish' in 720p" {
46+
ani-cli -q 720 banana fish
47+
}
48+
@example "Search for 'one piece', select 2nd entry and skip the intro" {
49+
ani-cli --skip --skip-title "one piece" -S 2 one piece
650
}
7-
def common_episodes [] {
8-
[ "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13" ]
51+
@example "Search for 'cyberpunk edgerunners' and download 2nd episode" {
52+
ani-cli -d -e 2 cyberpunk edgerunners
953
}
10-
def common_ranges [] {
11-
[ "1-5", "5-10", "1-13", "14-26", "1-26" ]
54+
@example "Search for 'cyberpunk edgerunners' 4th episode with VLC in 1080p" {
55+
ani-cli --vlc cyberpunk edgerunners -q 1080 -e 4
1256
}
57+
@example "Search for 'blue lock' 5th and 6th episodes" {
58+
ani-cli blue lock -e 5-6
59+
}
60+
@example "Search for 'blue lock' 5th and 6th episodes" {
61+
ani-cli -e "5 6" blue lock
62+
}
63+
export extern ani-cli [
64+
...query: string
65+
66+
--quality (-q): string@qualities
67+
# Specify the video quality
68+
69+
--episode (-e): string@episodes
70+
# Specify the episode number to watch
71+
72+
--range (-r): string@ranges
73+
# Specify the episode numbers to watch
74+
75+
--select-nth (-S): int
76+
# Selects nth entry
77+
78+
--skip-title: string
79+
# Use given title as ani-skip query
80+
81+
--syncplay (-s)
82+
# Use Syncplay to watch with friends (mpv only)
83+
84+
--download (-d)
85+
# Download the video instead of playing it
86+
87+
--continue (-c)
88+
# Continue watching from history
89+
90+
--help (-h)
91+
# Show summary of options
92+
93+
--delete (-D)
94+
# Delete history
95+
96+
--logview (-l)
97+
# Show logs
98+
99+
--update (-U)
100+
# Update the script
101+
102+
--version (-V)
103+
# Show the version of the script
104+
105+
--nextep-countdown (-N)
106+
# Display a countdown to the next episode
107+
108+
--vlc (-v)
109+
# Use VLC as the media player
110+
111+
--skip
112+
# Use ani-skip to skip the intro of the episode (mpv only)
113+
114+
--dub
115+
# Play the dubbed version
116+
117+
--rofi
118+
# Use rofi instead of fzf for the interactive menu
119+
120+
--no-detach
121+
# Don't detach the player (mpv only)
13122

14-
# Anime Search and Streaming Tool
15-
export extern "ani-cli" [
16-
string?
17-
-q: int@videoQuality # Specify video quality
18-
--quality: int@videoQuality # Specify video quality
19-
-s # Use Syncplay to watch with friends
20-
--syncplay # Use Syncplay to watch with friends
21-
-f # Use FZF for selection
22-
--fzf # Use FZF for selection
23-
-e: string@common_episodes # Specify episode number
24-
--episode: string@common_episodes # Specify episode number
25-
-d # Download the episode instead of playing it
26-
--download # Download the episode instead of playing it
27-
-p # Download episode to a specified directory
28-
--path: string # Download episode to a specified directory
29-
-c # Continue watching from history
30-
--continue # Continue watching from history
31-
-h # Show help text
32-
--help # Show help text
33-
-D # Delete history
34-
--delete # Delete history
35-
-l # Show logs
36-
--log-view # Show logs
37-
-U # Update the script
38-
--update # Update the script
39-
-V # Show the version of the script
40-
--version # Show the version of the script
41-
-r: string@common_ranges # Specify range number
42-
--range: string@common_ranges # Specify range number
43-
--skip # Use ani-skip to skip intros (mpv only)
44-
--dub # Play dubbed version
45-
--rofi # Use rofi instead of fzf for menu
46-
--no-detach # Don't detach the player (mpv only)
47-
--exit-after-play # Exit after playing (mpv only)
48-
--skip-title: string # Use the given title for ani-skip query
49-
-N # Display a countdown to the next episode
50-
--nextep-countdown # Display a countdown to the next episode
123+
--exit-after-play
124+
# Exit after playing, and return player exit code (mpv only)
51125
]

0 commit comments

Comments
 (0)