diff options
| author | salmonik <raisersoft@proton.me> | 2026-05-07 16:16:01 +0200 |
|---|---|---|
| committer | salmonik <raisersoft@proton.me> | 2026-05-07 16:16:01 +0200 |
| commit | 03f4585424d05dd50022759c7ad098fe06277f6e (patch) | |
| tree | 8b6e8a829afbfa949f7a55eaf5620ea99b17bf40 /completions/rsp.zsh | |
| parent | Add toggle command to resume/pause playback and fix queue display bug (diff) | |
| download | rsplayer-03f4585424d05dd50022759c7ad098fe06277f6e.tar.gz rsplayer-03f4585424d05dd50022759c7ad098fe06277f6e.zip | |
Fix queue bugs: play -i on empty queue, stale track replay after queue ends, shuffle preserving current position
- insert_after_current: guard against panic on empty queue
- play -i (now): skip position increment when queue was empty so track plays
- directory last: use audio.is_playing() instead of q.current() to avoid replaying finished track
- shuffle: only randomize tracks after current position
Diffstat (limited to 'completions/rsp.zsh')
| -rw-r--r-- | completions/rsp.zsh | 685 |
1 files changed, 662 insertions, 23 deletions
diff --git a/completions/rsp.zsh b/completions/rsp.zsh index cfba4e5..d635e3c 100644 --- a/completions/rsp.zsh +++ b/completions/rsp.zsh | |||
| @@ -1,26 +1,665 @@ | |||
| 1 | #compdef rsp | 1 | #compdef rsp |
| 2 | 2 | ||
| 3 | autoload -U is-at-least | ||
| 4 | |||
| 3 | _rsp() { | 5 | _rsp() { |
| 4 | _arguments -C \ | 6 | typeset -A opt_args |
| 5 | '1:command:->cmd' \ | 7 | typeset -a _arguments_options |
| 6 | '*::args:->args' | 8 | local ret=1 |
| 7 | 9 | ||
| 8 | case $state in | 10 | if is-at-least 5.2; then |
| 9 | cmd) | 11 | _arguments_options=(-s -S -C) |
| 10 | _values 'command' \ | 12 | else |
| 11 | 'start' 'stop' 'restart' 'play' 'pause' 'resume' 'toggle' 'next' 'previous' \ | 13 | _arguments_options=(-s -C) |
| 12 | 'volume' 'shuffle' 'queue' 'status' 'scan' 'settings' | 14 | fi |
| 13 | ;; | 15 | |
| 14 | args) | 16 | local context curcontext="$curcontext" state line |
| 15 | # if first word is "play", complete files/dirs | 17 | _arguments "${_arguments_options[@]}" : \ |
| 16 | if [[ $words[1] == play || $words[2] == play ]]; then | 18 | '-h[Print help]' \ |
| 17 | _files | 19 | '--help[Print help]' \ |
| 18 | else | 20 | ":: :_rsp_commands" \ |
| 19 | # default: complete nothing (or you can list other subcommand args) | 21 | "*::: :->rsp" \ |
| 20 | return 0 | 22 | && ret=0 |
| 21 | fi | 23 | case $state in |
| 22 | ;; | 24 | (rsp) |
| 23 | esac | 25 | words=($line[1] "${words[@]}") |
| 24 | } | 26 | (( CURRENT += 1 )) |
| 25 | 27 | curcontext="${curcontext%:*:*}:rsp-command-$line[1]:" | |
| 26 | compdef _rsp rsp | 28 | case $line[1] in |
| 29 | (start) | ||
| 30 | _arguments "${_arguments_options[@]}" : \ | ||
| 31 | '-h[Print help]' \ | ||
| 32 | '--help[Print help]' \ | ||
| 33 | && ret=0 | ||
| 34 | ;; | ||
| 35 | (stop) | ||
| 36 | _arguments "${_arguments_options[@]}" : \ | ||
| 37 | '-h[Print help]' \ | ||
| 38 | '--help[Print help]' \ | ||
| 39 | && ret=0 | ||
| 40 | ;; | ||
| 41 | (restart) | ||
| 42 | _arguments "${_arguments_options[@]}" : \ | ||
| 43 | '-h[Print help]' \ | ||
| 44 | '--help[Print help]' \ | ||
| 45 | && ret=0 | ||
| 46 | ;; | ||
| 47 | (play) | ||
| 48 | _arguments "${_arguments_options[@]}" : \ | ||
| 49 | '-i[Play immediately (add after current and skip to it)]' \ | ||
| 50 | '--now[Play immediately (add after current and skip to it)]' \ | ||
| 51 | '-n[Add to queue after current track (don'\''t skip)]' \ | ||
| 52 | '--next[Add to queue after current track (don'\''t skip)]' \ | ||
| 53 | '-l[Add to end of queue (default)]' \ | ||
| 54 | '--last[Add to end of queue (default)]' \ | ||
| 55 | '-L[List available artists/albums]' \ | ||
| 56 | '--list[List available artists/albums]' \ | ||
| 57 | '-h[Print help]' \ | ||
| 58 | '--help[Print help]' \ | ||
| 59 | '::query -- Artist/Album or local file path:_rsp_play_artist_album_completion' \ | ||
| 60 | && ret=0 | ||
| 61 | ;; | ||
| 62 | (pause) | ||
| 63 | _arguments "${_arguments_options[@]}" : \ | ||
| 64 | '-h[Print help]' \ | ||
| 65 | '--help[Print help]' \ | ||
| 66 | && ret=0 | ||
| 67 | ;; | ||
| 68 | (resume) | ||
| 69 | _arguments "${_arguments_options[@]}" : \ | ||
| 70 | '-h[Print help]' \ | ||
| 71 | '--help[Print help]' \ | ||
| 72 | && ret=0 | ||
| 73 | ;; | ||
| 74 | (toggle) | ||
| 75 | _arguments "${_arguments_options[@]}" : \ | ||
| 76 | '-h[Print help]' \ | ||
| 77 | '--help[Print help]' \ | ||
| 78 | && ret=0 | ||
| 79 | ;; | ||
| 80 | (stop-playback) | ||
| 81 | _arguments "${_arguments_options[@]}" : \ | ||
| 82 | '-h[Print help]' \ | ||
| 83 | '--help[Print help]' \ | ||
| 84 | && ret=0 | ||
| 85 | ;; | ||
| 86 | (next) | ||
| 87 | _arguments "${_arguments_options[@]}" : \ | ||
| 88 | '-h[Print help]' \ | ||
| 89 | '--help[Print help]' \ | ||
| 90 | && ret=0 | ||
| 91 | ;; | ||
| 92 | (previous) | ||
| 93 | _arguments "${_arguments_options[@]}" : \ | ||
| 94 | '-h[Print help]' \ | ||
| 95 | '--help[Print help]' \ | ||
| 96 | && ret=0 | ||
| 97 | ;; | ||
| 98 | (volume) | ||
| 99 | _arguments "${_arguments_options[@]}" : \ | ||
| 100 | '-h[Print help]' \ | ||
| 101 | '--help[Print help]' \ | ||
| 102 | '::level:_default' \ | ||
| 103 | && ret=0 | ||
| 104 | ;; | ||
| 105 | (shuffle) | ||
| 106 | _arguments "${_arguments_options[@]}" : \ | ||
| 107 | '-h[Print help]' \ | ||
| 108 | '--help[Print help]' \ | ||
| 109 | '::mode:_default' \ | ||
| 110 | && ret=0 | ||
| 111 | ;; | ||
| 112 | (queue) | ||
| 113 | _arguments "${_arguments_options[@]}" : \ | ||
| 114 | '-h[Print help]' \ | ||
| 115 | '--help[Print help]' \ | ||
| 116 | '::position:_default' \ | ||
| 117 | '::query:_default' \ | ||
| 118 | && ret=0 | ||
| 119 | ;; | ||
| 120 | (status) | ||
| 121 | _arguments "${_arguments_options[@]}" : \ | ||
| 122 | '-h[Print help]' \ | ||
| 123 | '--help[Print help]' \ | ||
| 124 | && ret=0 | ||
| 125 | ;; | ||
| 126 | (scan) | ||
| 127 | _arguments "${_arguments_options[@]}" : \ | ||
| 128 | '*--paths=[]:PATHS:_files' \ | ||
| 129 | '--force[]' \ | ||
| 130 | '-h[Print help]' \ | ||
| 131 | '--help[Print help]' \ | ||
| 132 | && ret=0 | ||
| 133 | ;; | ||
| 134 | (settings) | ||
| 135 | _arguments "${_arguments_options[@]}" : \ | ||
| 136 | '-h[Print help]' \ | ||
| 137 | '--help[Print help]' \ | ||
| 138 | ":: :_rsp__subcmd__settings_commands" \ | ||
| 139 | "*::: :->settings" \ | ||
| 140 | && ret=0 | ||
| 141 | |||
| 142 | case $state in | ||
| 143 | (settings) | ||
| 144 | words=($line[1] "${words[@]}") | ||
| 145 | (( CURRENT += 1 )) | ||
| 146 | curcontext="${curcontext%:*:*}:rsp-settings-command-$line[1]:" | ||
| 147 | case $line[1] in | ||
| 148 | (get) | ||
| 149 | _arguments "${_arguments_options[@]}" : \ | ||
| 150 | '-h[Print help]' \ | ||
| 151 | '--help[Print help]' \ | ||
| 152 | ':key:_default' \ | ||
| 153 | && ret=0 | ||
| 154 | ;; | ||
| 155 | (set) | ||
| 156 | _arguments "${_arguments_options[@]}" : \ | ||
| 157 | '-h[Print help]' \ | ||
| 158 | '--help[Print help]' \ | ||
| 159 | ':key:_default' \ | ||
| 160 | ':value:_default' \ | ||
| 161 | && ret=0 | ||
| 162 | ;; | ||
| 163 | (list) | ||
| 164 | _arguments "${_arguments_options[@]}" : \ | ||
| 165 | '-h[Print help]' \ | ||
| 166 | '--help[Print help]' \ | ||
| 167 | && ret=0 | ||
| 168 | ;; | ||
| 169 | (unset) | ||
| 170 | _arguments "${_arguments_options[@]}" : \ | ||
| 171 | '-h[Print help]' \ | ||
| 172 | '--help[Print help]' \ | ||
| 173 | ':key:_default' \ | ||
| 174 | && ret=0 | ||
| 175 | ;; | ||
| 176 | (help) | ||
| 177 | _arguments "${_arguments_options[@]}" : \ | ||
| 178 | ":: :_rsp__subcmd__settings__subcmd__help_commands" \ | ||
| 179 | "*::: :->help" \ | ||
| 180 | && ret=0 | ||
| 181 | |||
| 182 | case $state in | ||
| 183 | (help) | ||
| 184 | words=($line[1] "${words[@]}") | ||
| 185 | (( CURRENT += 1 )) | ||
| 186 | curcontext="${curcontext%:*:*}:rsp-settings-help-command-$line[1]:" | ||
| 187 | case $line[1] in | ||
| 188 | (get) | ||
| 189 | _arguments "${_arguments_options[@]}" : \ | ||
| 190 | && ret=0 | ||
| 191 | ;; | ||
| 192 | (set) | ||
| 193 | _arguments "${_arguments_options[@]}" : \ | ||
| 194 | && ret=0 | ||
| 195 | ;; | ||
| 196 | (list) | ||
| 197 | _arguments "${_arguments_options[@]}" : \ | ||
| 198 | && ret=0 | ||
| 199 | ;; | ||
| 200 | (unset) | ||
| 201 | _arguments "${_arguments_options[@]}" : \ | ||
| 202 | && ret=0 | ||
| 203 | ;; | ||
| 204 | (help) | ||
| 205 | _arguments "${_arguments_options[@]}" : \ | ||
| 206 | && ret=0 | ||
| 207 | ;; | ||
| 208 | esac | ||
| 209 | ;; | ||
| 210 | esac | ||
| 211 | ;; | ||
| 212 | esac | ||
| 213 | ;; | ||
| 214 | esac | ||
| 215 | ;; | ||
| 216 | (completions) | ||
| 217 | _arguments "${_arguments_options[@]}" : \ | ||
| 218 | '--shell=[Also print to stdout for a specific shell]:SHELL:(bash elvish fish powershell zsh)' \ | ||
| 219 | '-h[Print help]' \ | ||
| 220 | '--help[Print help]' \ | ||
| 221 | && ret=0 | ||
| 222 | ;; | ||
| 223 | (help) | ||
| 224 | _arguments "${_arguments_options[@]}" : \ | ||
| 225 | ":: :_rsp__subcmd__help_commands" \ | ||
| 226 | "*::: :->help" \ | ||
| 227 | && ret=0 | ||
| 228 | |||
| 229 | case $state in | ||
| 230 | (help) | ||
| 231 | words=($line[1] "${words[@]}") | ||
| 232 | (( CURRENT += 1 )) | ||
| 233 | curcontext="${curcontext%:*:*}:rsp-help-command-$line[1]:" | ||
| 234 | case $line[1] in | ||
| 235 | (start) | ||
| 236 | _arguments "${_arguments_options[@]}" : \ | ||
| 237 | && ret=0 | ||
| 238 | ;; | ||
| 239 | (stop) | ||
| 240 | _arguments "${_arguments_options[@]}" : \ | ||
| 241 | && ret=0 | ||
| 242 | ;; | ||
| 243 | (restart) | ||
| 244 | _arguments "${_arguments_options[@]}" : \ | ||
| 245 | && ret=0 | ||
| 246 | ;; | ||
| 247 | (play) | ||
| 248 | _arguments "${_arguments_options[@]}" : \ | ||
| 249 | && ret=0 | ||
| 250 | ;; | ||
| 251 | (pause) | ||
| 252 | _arguments "${_arguments_options[@]}" : \ | ||
| 253 | && ret=0 | ||
| 254 | ;; | ||
| 255 | (resume) | ||
| 256 | _arguments "${_arguments_options[@]}" : \ | ||
| 257 | && ret=0 | ||
| 258 | ;; | ||
| 259 | (toggle) | ||
| 260 | _arguments "${_arguments_options[@]}" : \ | ||
| 261 | && ret=0 | ||
| 262 | ;; | ||
| 263 | (stop-playback) | ||
| 264 | _arguments "${_arguments_options[@]}" : \ | ||
| 265 | && ret=0 | ||
| 266 | ;; | ||
| 267 | (next) | ||
| 268 | _arguments "${_arguments_options[@]}" : \ | ||
| 269 | && ret=0 | ||
| 270 | ;; | ||
| 271 | (previous) | ||
| 272 | _arguments "${_arguments_options[@]}" : \ | ||
| 273 | && ret=0 | ||
| 274 | ;; | ||
| 275 | (volume) | ||
| 276 | _arguments "${_arguments_options[@]}" : \ | ||
| 277 | && ret=0 | ||
| 278 | ;; | ||
| 279 | (shuffle) | ||
| 280 | _arguments "${_arguments_options[@]}" : \ | ||
| 281 | && ret=0 | ||
| 282 | ;; | ||
| 283 | (queue) | ||
| 284 | _arguments "${_arguments_options[@]}" : \ | ||
| 285 | && ret=0 | ||
| 286 | ;; | ||
| 287 | (status) | ||
| 288 | _arguments "${_arguments_options[@]}" : \ | ||
| 289 | && ret=0 | ||
| 290 | ;; | ||
| 291 | (scan) | ||
| 292 | _arguments "${_arguments_options[@]}" : \ | ||
| 293 | && ret=0 | ||
| 294 | ;; | ||
| 295 | (settings) | ||
| 296 | _arguments "${_arguments_options[@]}" : \ | ||
| 297 | ":: :_rsp__subcmd__help__subcmd__settings_commands" \ | ||
| 298 | "*::: :->settings" \ | ||
| 299 | && ret=0 | ||
| 300 | |||
| 301 | case $state in | ||
| 302 | (settings) | ||
| 303 | words=($line[1] "${words[@]}") | ||
| 304 | (( CURRENT += 1 )) | ||
| 305 | curcontext="${curcontext%:*:*}:rsp-help-settings-command-$line[1]:" | ||
| 306 | case $line[1] in | ||
| 307 | (get) | ||
| 308 | _arguments "${_arguments_options[@]}" : \ | ||
| 309 | && ret=0 | ||
| 310 | ;; | ||
| 311 | (set) | ||
| 312 | _arguments "${_arguments_options[@]}" : \ | ||
| 313 | && ret=0 | ||
| 314 | ;; | ||
| 315 | (list) | ||
| 316 | _arguments "${_arguments_options[@]}" : \ | ||
| 317 | && ret=0 | ||
| 318 | ;; | ||
| 319 | (unset) | ||
| 320 | _arguments "${_arguments_options[@]}" : \ | ||
| 321 | && ret=0 | ||
| 322 | ;; | ||
| 323 | esac | ||
| 324 | ;; | ||
| 325 | esac | ||
| 326 | ;; | ||
| 327 | (completions) | ||
| 328 | _arguments "${_arguments_options[@]}" : \ | ||
| 329 | && ret=0 | ||
| 330 | ;; | ||
| 331 | (help) | ||
| 332 | _arguments "${_arguments_options[@]}" : \ | ||
| 333 | && ret=0 | ||
| 334 | ;; | ||
| 335 | esac | ||
| 336 | ;; | ||
| 337 | esac | ||
| 338 | ;; | ||
| 339 | esac | ||
| 340 | ;; | ||
| 341 | esac | ||
| 342 | } | ||
| 343 | |||
| 344 | (( $+functions[_rsp_commands] )) || | ||
| 345 | _rsp_commands() { | ||
| 346 | local commands; commands=( | ||
| 347 | 'start:Start the daemon' \ | ||
| 348 | 'stop:Stop the daemon' \ | ||
| 349 | 'restart:Restart the daemon (kill existing and start new)' \ | ||
| 350 | 'play:Play a track, album, or artist' \ | ||
| 351 | 'pause:Pause playback' \ | ||
| 352 | 'resume:Resume playback' \ | ||
| 353 | 'toggle:Toggle play/pause' \ | ||
| 354 | 'stop-playback:Stop playback' \ | ||
| 355 | 'next:Skip to next track' \ | ||
| 356 | 'previous:Skip to previous track' \ | ||
| 357 | 'volume:Set volume (0-100)' \ | ||
| 358 | 'shuffle:Shuffle mode' \ | ||
| 359 | 'queue:Queue management' \ | ||
| 360 | 'status:Show player status' \ | ||
| 361 | 'scan:Scan music paths to populate database' \ | ||
| 362 | 'settings:Settings management' \ | ||
| 363 | 'completions:Generate shell completions and write to completions/ directory (bash, elvish, fish, powershell, zsh)' \ | ||
| 364 | 'help:Print this message or the help of the given subcommand(s)' \ | ||
| 365 | ) | ||
| 366 | _describe -t commands 'rsp commands' commands "$@" | ||
| 367 | } | ||
| 368 | (( $+functions[_rsp__subcmd__completions_commands] )) || | ||
| 369 | _rsp__subcmd__completions_commands() { | ||
| 370 | local commands; commands=() | ||
| 371 | _describe -t commands 'rsp completions commands' commands "$@" | ||
| 372 | } | ||
| 373 | (( $+functions[_rsp__subcmd__help_commands] )) || | ||
| 374 | _rsp__subcmd__help_commands() { | ||
| 375 | local commands; commands=( | ||
| 376 | 'start:Start the daemon' \ | ||
| 377 | 'stop:Stop the daemon' \ | ||
| 378 | 'restart:Restart the daemon (kill existing and start new)' \ | ||
| 379 | 'play:Play a track, album, or artist' \ | ||
| 380 | 'pause:Pause playback' \ | ||
| 381 | 'resume:Resume playback' \ | ||
| 382 | 'toggle:Toggle play/pause' \ | ||
| 383 | 'stop-playback:Stop playback' \ | ||
| 384 | 'next:Skip to next track' \ | ||
| 385 | 'previous:Skip to previous track' \ | ||
| 386 | 'volume:Set volume (0-100)' \ | ||
| 387 | 'shuffle:Shuffle mode' \ | ||
| 388 | 'queue:Queue management' \ | ||
| 389 | 'status:Show player status' \ | ||
| 390 | 'scan:Scan music paths to populate database' \ | ||
| 391 | 'settings:Settings management' \ | ||
| 392 | 'completions:Generate shell completions and write to completions/ directory (bash, elvish, fish, powershell, zsh)' \ | ||
| 393 | 'help:Print this message or the help of the given subcommand(s)' \ | ||
| 394 | ) | ||
| 395 | _describe -t commands 'rsp help commands' commands "$@" | ||
| 396 | } | ||
| 397 | (( $+functions[_rsp__subcmd__help__subcmd__completions_commands] )) || | ||
| 398 | _rsp__subcmd__help__subcmd__completions_commands() { | ||
| 399 | local commands; commands=() | ||
| 400 | _describe -t commands 'rsp help completions commands' commands "$@" | ||
| 401 | } | ||
| 402 | (( $+functions[_rsp__subcmd__help__subcmd__help_commands] )) || | ||
| 403 | _rsp__subcmd__help__subcmd__help_commands() { | ||
| 404 | local commands; commands=() | ||
| 405 | _describe -t commands 'rsp help help commands' commands "$@" | ||
| 406 | } | ||
| 407 | (( $+functions[_rsp__subcmd__help__subcmd__next_commands] )) || | ||
| 408 | _rsp__subcmd__help__subcmd__next_commands() { | ||
| 409 | local commands; commands=() | ||
| 410 | _describe -t commands 'rsp help next commands' commands "$@" | ||
| 411 | } | ||
| 412 | (( $+functions[_rsp__subcmd__help__subcmd__pause_commands] )) || | ||
| 413 | _rsp__subcmd__help__subcmd__pause_commands() { | ||
| 414 | local commands; commands=() | ||
| 415 | _describe -t commands 'rsp help pause commands' commands "$@" | ||
| 416 | } | ||
| 417 | (( $+functions[_rsp__subcmd__help__subcmd__play_commands] )) || | ||
| 418 | _rsp__subcmd__help__subcmd__play_commands() { | ||
| 419 | local commands; commands=() | ||
| 420 | _describe -t commands 'rsp help play commands' commands "$@" | ||
| 421 | } | ||
| 422 | (( $+functions[_rsp__subcmd__help__subcmd__previous_commands] )) || | ||
| 423 | _rsp__subcmd__help__subcmd__previous_commands() { | ||
| 424 | local commands; commands=() | ||
| 425 | _describe -t commands 'rsp help previous commands' commands "$@" | ||
| 426 | } | ||
| 427 | (( $+functions[_rsp__subcmd__help__subcmd__queue_commands] )) || | ||
| 428 | _rsp__subcmd__help__subcmd__queue_commands() { | ||
| 429 | local commands; commands=() | ||
| 430 | _describe -t commands 'rsp help queue commands' commands "$@" | ||
| 431 | } | ||
| 432 | (( $+functions[_rsp__subcmd__help__subcmd__restart_commands] )) || | ||
| 433 | _rsp__subcmd__help__subcmd__restart_commands() { | ||
| 434 | local commands; commands=() | ||
| 435 | _describe -t commands 'rsp help restart commands' commands "$@" | ||
| 436 | } | ||
| 437 | (( $+functions[_rsp__subcmd__help__subcmd__resume_commands] )) || | ||
| 438 | _rsp__subcmd__help__subcmd__resume_commands() { | ||
| 439 | local commands; commands=() | ||
| 440 | _describe -t commands 'rsp help resume commands' commands "$@" | ||
| 441 | } | ||
| 442 | (( $+functions[_rsp__subcmd__help__subcmd__scan_commands] )) || | ||
| 443 | _rsp__subcmd__help__subcmd__scan_commands() { | ||
| 444 | local commands; commands=() | ||
| 445 | _describe -t commands 'rsp help scan commands' commands "$@" | ||
| 446 | } | ||
| 447 | (( $+functions[_rsp__subcmd__help__subcmd__settings_commands] )) || | ||
| 448 | _rsp__subcmd__help__subcmd__settings_commands() { | ||
| 449 | local commands; commands=( | ||
| 450 | 'get:Get a setting value' \ | ||
| 451 | 'set:Set a setting value' \ | ||
| 452 | 'list:List all settings' \ | ||
| 453 | 'unset:Unset a setting' \ | ||
| 454 | ) | ||
| 455 | _describe -t commands 'rsp help settings commands' commands "$@" | ||
| 456 | } | ||
| 457 | (( $+functions[_rsp__subcmd__help__subcmd__settings__subcmd__get_commands] )) || | ||
| 458 | _rsp__subcmd__help__subcmd__settings__subcmd__get_commands() { | ||
| 459 | local commands; commands=() | ||
| 460 | _describe -t commands 'rsp help settings get commands' commands "$@" | ||
| 461 | } | ||
| 462 | (( $+functions[_rsp__subcmd__help__subcmd__settings__subcmd__list_commands] )) || | ||
| 463 | _rsp__subcmd__help__subcmd__settings__subcmd__list_commands() { | ||
| 464 | local commands; commands=() | ||
| 465 | _describe -t commands 'rsp help settings list commands' commands "$@" | ||
| 466 | } | ||
| 467 | (( $+functions[_rsp__subcmd__help__subcmd__settings__subcmd__set_commands] )) || | ||
| 468 | _rsp__subcmd__help__subcmd__settings__subcmd__set_commands() { | ||
| 469 | local commands; commands=() | ||
| 470 | _describe -t commands 'rsp help settings set commands' commands "$@" | ||
| 471 | } | ||
| 472 | (( $+functions[_rsp__subcmd__help__subcmd__settings__subcmd__unset_commands] )) || | ||
| 473 | _rsp__subcmd__help__subcmd__settings__subcmd__unset_commands() { | ||
| 474 | local commands; commands=() | ||
| 475 | _describe -t commands 'rsp help settings unset commands' commands "$@" | ||
| 476 | } | ||
| 477 | (( $+functions[_rsp__subcmd__help__subcmd__shuffle_commands] )) || | ||
| 478 | _rsp__subcmd__help__subcmd__shuffle_commands() { | ||
| 479 | local commands; commands=() | ||
| 480 | _describe -t commands 'rsp help shuffle commands' commands "$@" | ||
| 481 | } | ||
| 482 | (( $+functions[_rsp__subcmd__help__subcmd__start_commands] )) || | ||
| 483 | _rsp__subcmd__help__subcmd__start_commands() { | ||
| 484 | local commands; commands=() | ||
| 485 | _describe -t commands 'rsp help start commands' commands "$@" | ||
| 486 | } | ||
| 487 | (( $+functions[_rsp__subcmd__help__subcmd__status_commands] )) || | ||
| 488 | _rsp__subcmd__help__subcmd__status_commands() { | ||
| 489 | local commands; commands=() | ||
| 490 | _describe -t commands 'rsp help status commands' commands "$@" | ||
| 491 | } | ||
| 492 | (( $+functions[_rsp__subcmd__help__subcmd__stop_commands] )) || | ||
| 493 | _rsp__subcmd__help__subcmd__stop_commands() { | ||
| 494 | local commands; commands=() | ||
| 495 | _describe -t commands 'rsp help stop commands' commands "$@" | ||
| 496 | } | ||
| 497 | (( $+functions[_rsp__subcmd__help__subcmd__stop-playback_commands] )) || | ||
| 498 | _rsp__subcmd__help__subcmd__stop-playback_commands() { | ||
| 499 | local commands; commands=() | ||
| 500 | _describe -t commands 'rsp help stop-playback commands' commands "$@" | ||
| 501 | } | ||
| 502 | (( $+functions[_rsp__subcmd__help__subcmd__toggle_commands] )) || | ||
| 503 | _rsp__subcmd__help__subcmd__toggle_commands() { | ||
| 504 | local commands; commands=() | ||
| 505 | _describe -t commands 'rsp help toggle commands' commands "$@" | ||
| 506 | } | ||
| 507 | (( $+functions[_rsp__subcmd__help__subcmd__volume_commands] )) || | ||
| 508 | _rsp__subcmd__help__subcmd__volume_commands() { | ||
| 509 | local commands; commands=() | ||
| 510 | _describe -t commands 'rsp help volume commands' commands "$@" | ||
| 511 | } | ||
| 512 | (( $+functions[_rsp__subcmd__next_commands] )) || | ||
| 513 | _rsp__subcmd__next_commands() { | ||
| 514 | local commands; commands=() | ||
| 515 | _describe -t commands 'rsp next commands' commands "$@" | ||
| 516 | } | ||
| 517 | (( $+functions[_rsp__subcmd__pause_commands] )) || | ||
| 518 | _rsp__subcmd__pause_commands() { | ||
| 519 | local commands; commands=() | ||
| 520 | _describe -t commands 'rsp pause commands' commands "$@" | ||
| 521 | } | ||
| 522 | (( $+functions[_rsp__subcmd__play_commands] )) || | ||
| 523 | _rsp__subcmd__play_commands() { | ||
| 524 | local commands; commands=() | ||
| 525 | _describe -t commands 'rsp play commands' commands "$@" | ||
| 526 | } | ||
| 527 | (( $+functions[_rsp__subcmd__previous_commands] )) || | ||
| 528 | _rsp__subcmd__previous_commands() { | ||
| 529 | local commands; commands=() | ||
| 530 | _describe -t commands 'rsp previous commands' commands "$@" | ||
| 531 | } | ||
| 532 | (( $+functions[_rsp__subcmd__queue_commands] )) || | ||
| 533 | _rsp__subcmd__queue_commands() { | ||
| 534 | local commands; commands=() | ||
| 535 | _describe -t commands 'rsp queue commands' commands "$@" | ||
| 536 | } | ||
| 537 | (( $+functions[_rsp__subcmd__restart_commands] )) || | ||
| 538 | _rsp__subcmd__restart_commands() { | ||
| 539 | local commands; commands=() | ||
| 540 | _describe -t commands 'rsp restart commands' commands "$@" | ||
| 541 | } | ||
| 542 | (( $+functions[_rsp__subcmd__resume_commands] )) || | ||
| 543 | _rsp__subcmd__resume_commands() { | ||
| 544 | local commands; commands=() | ||
| 545 | _describe -t commands 'rsp resume commands' commands "$@" | ||
| 546 | } | ||
| 547 | (( $+functions[_rsp__subcmd__scan_commands] )) || | ||
| 548 | _rsp__subcmd__scan_commands() { | ||
| 549 | local commands; commands=() | ||
| 550 | _describe -t commands 'rsp scan commands' commands "$@" | ||
| 551 | } | ||
| 552 | (( $+functions[_rsp__subcmd__settings_commands] )) || | ||
| 553 | _rsp__subcmd__settings_commands() { | ||
| 554 | local commands; commands=( | ||
| 555 | 'get:Get a setting value' \ | ||
| 556 | 'set:Set a setting value' \ | ||
| 557 | 'list:List all settings' \ | ||
| 558 | 'unset:Unset a setting' \ | ||
| 559 | 'help:Print this message or the help of the given subcommand(s)' \ | ||
| 560 | ) | ||
| 561 | _describe -t commands 'rsp settings commands' commands "$@" | ||
| 562 | } | ||
| 563 | (( $+functions[_rsp__subcmd__settings__subcmd__get_commands] )) || | ||
| 564 | _rsp__subcmd__settings__subcmd__get_commands() { | ||
| 565 | local commands; commands=() | ||
| 566 | _describe -t commands 'rsp settings get commands' commands "$@" | ||
| 567 | } | ||
| 568 | (( $+functions[_rsp__subcmd__settings__subcmd__help_commands] )) || | ||
| 569 | _rsp__subcmd__settings__subcmd__help_commands() { | ||
| 570 | local commands; commands=( | ||
| 571 | 'get:Get a setting value' \ | ||
| 572 | 'set:Set a setting value' \ | ||
| 573 | 'list:List all settings' \ | ||
| 574 | 'unset:Unset a setting' \ | ||
| 575 | 'help:Print this message or the help of the given subcommand(s)' \ | ||
| 576 | ) | ||
| 577 | _describe -t commands 'rsp settings help commands' commands "$@" | ||
| 578 | } | ||
| 579 | (( $+functions[_rsp__subcmd__settings__subcmd__help__subcmd__get_commands] )) || | ||
| 580 | _rsp__subcmd__settings__subcmd__help__subcmd__get_commands() { | ||
| 581 | local commands; commands=() | ||
| 582 | _describe -t commands 'rsp settings help get commands' commands "$@" | ||
| 583 | } | ||
| 584 | (( $+functions[_rsp__subcmd__settings__subcmd__help__subcmd__help_commands] )) || | ||
| 585 | _rsp__subcmd__settings__subcmd__help__subcmd__help_commands() { | ||
| 586 | local commands; commands=() | ||
| 587 | _describe -t commands 'rsp settings help help commands' commands "$@" | ||
| 588 | } | ||
| 589 | (( $+functions[_rsp__subcmd__settings__subcmd__help__subcmd__list_commands] )) || | ||
| 590 | _rsp__subcmd__settings__subcmd__help__subcmd__list_commands() { | ||
| 591 | local commands; commands=() | ||
| 592 | _describe -t commands 'rsp settings help list commands' commands "$@" | ||
| 593 | } | ||
| 594 | (( $+functions[_rsp__subcmd__settings__subcmd__help__subcmd__set_commands] )) || | ||
| 595 | _rsp__subcmd__settings__subcmd__help__subcmd__set_commands() { | ||
| 596 | local commands; commands=() | ||
| 597 | _describe -t commands 'rsp settings help set commands' commands "$@" | ||
| 598 | } | ||
| 599 | (( $+functions[_rsp__subcmd__settings__subcmd__help__subcmd__unset_commands] )) || | ||
| 600 | _rsp__subcmd__settings__subcmd__help__subcmd__unset_commands() { | ||
| 601 | local commands; commands=() | ||
| 602 | _describe -t commands 'rsp settings help unset commands' commands "$@" | ||
| 603 | } | ||
| 604 | (( $+functions[_rsp__subcmd__settings__subcmd__list_commands] )) || | ||
| 605 | _rsp__subcmd__settings__subcmd__list_commands() { | ||
| 606 | local commands; commands=() | ||
| 607 | _describe -t commands 'rsp settings list commands' commands "$@" | ||
| 608 | } | ||
| 609 | (( $+functions[_rsp__subcmd__settings__subcmd__set_commands] )) || | ||
| 610 | _rsp__subcmd__settings__subcmd__set_commands() { | ||
| 611 | local commands; commands=() | ||
| 612 | _describe -t commands 'rsp settings set commands' commands "$@" | ||
| 613 | } | ||
| 614 | (( $+functions[_rsp__subcmd__settings__subcmd__unset_commands] )) || | ||
| 615 | _rsp__subcmd__settings__subcmd__unset_commands() { | ||
| 616 | local commands; commands=() | ||
| 617 | _describe -t commands 'rsp settings unset commands' commands "$@" | ||
| 618 | } | ||
| 619 | (( $+functions[_rsp__subcmd__shuffle_commands] )) || | ||
| 620 | _rsp__subcmd__shuffle_commands() { | ||
| 621 | local commands; commands=() | ||
| 622 | _describe -t commands 'rsp shuffle commands' commands "$@" | ||
| 623 | } | ||
| 624 | (( $+functions[_rsp__subcmd__start_commands] )) || | ||
| 625 | _rsp__subcmd__start_commands() { | ||
| 626 | local commands; commands=() | ||
| 627 | _describe -t commands 'rsp start commands' commands "$@" | ||
| 628 | } | ||
| 629 | (( $+functions[_rsp__subcmd__status_commands] )) || | ||
| 630 | _rsp__subcmd__status_commands() { | ||
| 631 | local commands; commands=() | ||
| 632 | _describe -t commands 'rsp status commands' commands "$@" | ||
| 633 | } | ||
| 634 | (( $+functions[_rsp__subcmd__stop_commands] )) || | ||
| 635 | _rsp__subcmd__stop_commands() { | ||
| 636 | local commands; commands=() | ||
| 637 | _describe -t commands 'rsp stop commands' commands "$@" | ||
| 638 | } | ||
| 639 | (( $+functions[_rsp__subcmd__stop-playback_commands] )) || | ||
| 640 | _rsp__subcmd__stop-playback_commands() { | ||
| 641 | local commands; commands=() | ||
| 642 | _describe -t commands 'rsp stop-playback commands' commands "$@" | ||
| 643 | } | ||
| 644 | (( $+functions[_rsp__subcmd__toggle_commands] )) || | ||
| 645 | _rsp__subcmd__toggle_commands() { | ||
| 646 | local commands; commands=() | ||
| 647 | _describe -t commands 'rsp toggle commands' commands "$@" | ||
| 648 | } | ||
| 649 | (( $+functions[_rsp__subcmd__volume_commands] )) || | ||
| 650 | _rsp__subcmd__volume_commands() { | ||
| 651 | local commands; commands=() | ||
| 652 | _describe -t commands 'rsp volume commands' commands "$@" | ||
| 653 | } | ||
| 654 | |||
| 655 | if [ "$funcstack[1]" = "_rsp" ]; then | ||
| 656 | _rsp "$@" | ||
| 657 | else | ||
| 658 | compdef _rsp rsp | ||
| 659 | fi | ||
| 660 | |||
| 661 | _rsp_play_artist_album_completion() { | ||
| 662 | local -a artists | ||
| 663 | artists=("$(rsp play --list 2>/dev/null)") | ||
| 664 | _describe -t artist-album 'artist/album' artists | ||
| 665 | } | ||
