diff options
Diffstat (limited to 'completions/rsp.zsh')
| -rw-r--r-- | completions/rsp.zsh | 70 |
1 files changed, 30 insertions, 40 deletions
diff --git a/completions/rsp.zsh b/completions/rsp.zsh index d635e3c..e8da3d7 100644 --- a/completions/rsp.zsh +++ b/completions/rsp.zsh | |||
| @@ -26,13 +26,13 @@ _rsp() { | |||
| 26 | (( CURRENT += 1 )) | 26 | (( CURRENT += 1 )) |
| 27 | curcontext="${curcontext%:*:*}:rsp-command-$line[1]:" | 27 | curcontext="${curcontext%:*:*}:rsp-command-$line[1]:" |
| 28 | case $line[1] in | 28 | case $line[1] in |
| 29 | (start) | 29 | (start-daemon) |
| 30 | _arguments "${_arguments_options[@]}" : \ | 30 | _arguments "${_arguments_options[@]}" : \ |
| 31 | '-h[Print help]' \ | 31 | '-h[Print help]' \ |
| 32 | '--help[Print help]' \ | 32 | '--help[Print help]' \ |
| 33 | && ret=0 | 33 | && ret=0 |
| 34 | ;; | 34 | ;; |
| 35 | (stop) | 35 | (stop-daemon) |
| 36 | _arguments "${_arguments_options[@]}" : \ | 36 | _arguments "${_arguments_options[@]}" : \ |
| 37 | '-h[Print help]' \ | 37 | '-h[Print help]' \ |
| 38 | '--help[Print help]' \ | 38 | '--help[Print help]' \ |
| @@ -46,17 +46,13 @@ _arguments "${_arguments_options[@]}" : \ | |||
| 46 | ;; | 46 | ;; |
| 47 | (play) | 47 | (play) |
| 48 | _arguments "${_arguments_options[@]}" : \ | 48 | _arguments "${_arguments_options[@]}" : \ |
| 49 | '-i[Play immediately (add after current and skip to it)]' \ | 49 | '-i[Add after current track and skip to it]' \ |
| 50 | '--now[Play immediately (add after current and skip to it)]' \ | 50 | '--now[Add after current track and skip to it]' \ |
| 51 | '-n[Add to queue after current track (don'\''t skip)]' \ | 51 | '-n[Add to queue after current track (don'\''t skip)]' \ |
| 52 | '--next[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]' \ | 53 | '-h[Print help]' \ |
| 58 | '--help[Print help]' \ | 54 | '--help[Print help]' \ |
| 59 | '::query -- Artist/Album or local file path:_rsp_play_artist_album_completion' \ | 55 | '::query:_default' \ |
| 60 | && ret=0 | 56 | && ret=0 |
| 61 | ;; | 57 | ;; |
| 62 | (pause) | 58 | (pause) |
| @@ -77,7 +73,7 @@ _arguments "${_arguments_options[@]}" : \ | |||
| 77 | '--help[Print help]' \ | 73 | '--help[Print help]' \ |
| 78 | && ret=0 | 74 | && ret=0 |
| 79 | ;; | 75 | ;; |
| 80 | (stop-playback) | 76 | (stop) |
| 81 | _arguments "${_arguments_options[@]}" : \ | 77 | _arguments "${_arguments_options[@]}" : \ |
| 82 | '-h[Print help]' \ | 78 | '-h[Print help]' \ |
| 83 | '--help[Print help]' \ | 79 | '--help[Print help]' \ |
| @@ -215,9 +211,9 @@ esac | |||
| 215 | ;; | 211 | ;; |
| 216 | (completions) | 212 | (completions) |
| 217 | _arguments "${_arguments_options[@]}" : \ | 213 | _arguments "${_arguments_options[@]}" : \ |
| 218 | '--shell=[Also print to stdout for a specific shell]:SHELL:(bash elvish fish powershell zsh)' \ | ||
| 219 | '-h[Print help]' \ | 214 | '-h[Print help]' \ |
| 220 | '--help[Print help]' \ | 215 | '--help[Print help]' \ |
| 216 | '::shell -- Shell to generate (bash, zsh, fish, elvish, powershell) If not specified, generates all completion files:_default' \ | ||
| 221 | && ret=0 | 217 | && ret=0 |
| 222 | ;; | 218 | ;; |
| 223 | (help) | 219 | (help) |
| @@ -232,11 +228,11 @@ _arguments "${_arguments_options[@]}" : \ | |||
| 232 | (( CURRENT += 1 )) | 228 | (( CURRENT += 1 )) |
| 233 | curcontext="${curcontext%:*:*}:rsp-help-command-$line[1]:" | 229 | curcontext="${curcontext%:*:*}:rsp-help-command-$line[1]:" |
| 234 | case $line[1] in | 230 | case $line[1] in |
| 235 | (start) | 231 | (start-daemon) |
| 236 | _arguments "${_arguments_options[@]}" : \ | 232 | _arguments "${_arguments_options[@]}" : \ |
| 237 | && ret=0 | 233 | && ret=0 |
| 238 | ;; | 234 | ;; |
| 239 | (stop) | 235 | (stop-daemon) |
| 240 | _arguments "${_arguments_options[@]}" : \ | 236 | _arguments "${_arguments_options[@]}" : \ |
| 241 | && ret=0 | 237 | && ret=0 |
| 242 | ;; | 238 | ;; |
| @@ -260,7 +256,7 @@ _arguments "${_arguments_options[@]}" : \ | |||
| 260 | _arguments "${_arguments_options[@]}" : \ | 256 | _arguments "${_arguments_options[@]}" : \ |
| 261 | && ret=0 | 257 | && ret=0 |
| 262 | ;; | 258 | ;; |
| 263 | (stop-playback) | 259 | (stop) |
| 264 | _arguments "${_arguments_options[@]}" : \ | 260 | _arguments "${_arguments_options[@]}" : \ |
| 265 | && ret=0 | 261 | && ret=0 |
| 266 | ;; | 262 | ;; |
| @@ -344,14 +340,14 @@ esac | |||
| 344 | (( $+functions[_rsp_commands] )) || | 340 | (( $+functions[_rsp_commands] )) || |
| 345 | _rsp_commands() { | 341 | _rsp_commands() { |
| 346 | local commands; commands=( | 342 | local commands; commands=( |
| 347 | 'start:Start the daemon' \ | 343 | 'start-daemon:Start the daemon' \ |
| 348 | 'stop:Stop the daemon' \ | 344 | 'stop-daemon:Stop the daemon' \ |
| 349 | 'restart:Restart the daemon (kill existing and start new)' \ | 345 | 'restart:Restart the daemon (kill existing and start new)' \ |
| 350 | 'play:Play a track, album, or artist' \ | 346 | 'play:Play a track, album, or artist' \ |
| 351 | 'pause:Pause playback' \ | 347 | 'pause:Pause playback' \ |
| 352 | 'resume:Resume playback' \ | 348 | 'resume:Resume playback' \ |
| 353 | 'toggle:Toggle play/pause' \ | 349 | 'toggle:Toggle play/pause' \ |
| 354 | 'stop-playback:Stop playback' \ | 350 | 'stop:Stop playback' \ |
| 355 | 'next:Skip to next track' \ | 351 | 'next:Skip to next track' \ |
| 356 | 'previous:Skip to previous track' \ | 352 | 'previous:Skip to previous track' \ |
| 357 | 'volume:Set volume (0-100)' \ | 353 | 'volume:Set volume (0-100)' \ |
| @@ -360,7 +356,7 @@ _rsp_commands() { | |||
| 360 | 'status:Show player status' \ | 356 | 'status:Show player status' \ |
| 361 | 'scan:Scan music paths to populate database' \ | 357 | 'scan:Scan music paths to populate database' \ |
| 362 | 'settings:Settings management' \ | 358 | 'settings:Settings management' \ |
| 363 | 'completions:Generate shell completions and write to completions/ directory (bash, elvish, fish, powershell, zsh)' \ | 359 | 'completions:Generate shell completions (developer only)' \ |
| 364 | 'help:Print this message or the help of the given subcommand(s)' \ | 360 | 'help:Print this message or the help of the given subcommand(s)' \ |
| 365 | ) | 361 | ) |
| 366 | _describe -t commands 'rsp commands' commands "$@" | 362 | _describe -t commands 'rsp commands' commands "$@" |
| @@ -373,14 +369,14 @@ _rsp__subcmd__completions_commands() { | |||
| 373 | (( $+functions[_rsp__subcmd__help_commands] )) || | 369 | (( $+functions[_rsp__subcmd__help_commands] )) || |
| 374 | _rsp__subcmd__help_commands() { | 370 | _rsp__subcmd__help_commands() { |
| 375 | local commands; commands=( | 371 | local commands; commands=( |
| 376 | 'start:Start the daemon' \ | 372 | 'start-daemon:Start the daemon' \ |
| 377 | 'stop:Stop the daemon' \ | 373 | 'stop-daemon:Stop the daemon' \ |
| 378 | 'restart:Restart the daemon (kill existing and start new)' \ | 374 | 'restart:Restart the daemon (kill existing and start new)' \ |
| 379 | 'play:Play a track, album, or artist' \ | 375 | 'play:Play a track, album, or artist' \ |
| 380 | 'pause:Pause playback' \ | 376 | 'pause:Pause playback' \ |
| 381 | 'resume:Resume playback' \ | 377 | 'resume:Resume playback' \ |
| 382 | 'toggle:Toggle play/pause' \ | 378 | 'toggle:Toggle play/pause' \ |
| 383 | 'stop-playback:Stop playback' \ | 379 | 'stop:Stop playback' \ |
| 384 | 'next:Skip to next track' \ | 380 | 'next:Skip to next track' \ |
| 385 | 'previous:Skip to previous track' \ | 381 | 'previous:Skip to previous track' \ |
| 386 | 'volume:Set volume (0-100)' \ | 382 | 'volume:Set volume (0-100)' \ |
| @@ -389,7 +385,7 @@ _rsp__subcmd__help_commands() { | |||
| 389 | 'status:Show player status' \ | 385 | 'status:Show player status' \ |
| 390 | 'scan:Scan music paths to populate database' \ | 386 | 'scan:Scan music paths to populate database' \ |
| 391 | 'settings:Settings management' \ | 387 | 'settings:Settings management' \ |
| 392 | 'completions:Generate shell completions and write to completions/ directory (bash, elvish, fish, powershell, zsh)' \ | 388 | 'completions:Generate shell completions (developer only)' \ |
| 393 | 'help:Print this message or the help of the given subcommand(s)' \ | 389 | 'help:Print this message or the help of the given subcommand(s)' \ |
| 394 | ) | 390 | ) |
| 395 | _describe -t commands 'rsp help commands' commands "$@" | 391 | _describe -t commands 'rsp help commands' commands "$@" |
| @@ -479,10 +475,10 @@ _rsp__subcmd__help__subcmd__shuffle_commands() { | |||
| 479 | local commands; commands=() | 475 | local commands; commands=() |
| 480 | _describe -t commands 'rsp help shuffle commands' commands "$@" | 476 | _describe -t commands 'rsp help shuffle commands' commands "$@" |
| 481 | } | 477 | } |
| 482 | (( $+functions[_rsp__subcmd__help__subcmd__start_commands] )) || | 478 | (( $+functions[_rsp__subcmd__help__subcmd__start-daemon_commands] )) || |
| 483 | _rsp__subcmd__help__subcmd__start_commands() { | 479 | _rsp__subcmd__help__subcmd__start-daemon_commands() { |
| 484 | local commands; commands=() | 480 | local commands; commands=() |
| 485 | _describe -t commands 'rsp help start commands' commands "$@" | 481 | _describe -t commands 'rsp help start-daemon commands' commands "$@" |
| 486 | } | 482 | } |
| 487 | (( $+functions[_rsp__subcmd__help__subcmd__status_commands] )) || | 483 | (( $+functions[_rsp__subcmd__help__subcmd__status_commands] )) || |
| 488 | _rsp__subcmd__help__subcmd__status_commands() { | 484 | _rsp__subcmd__help__subcmd__status_commands() { |
| @@ -494,10 +490,10 @@ _rsp__subcmd__help__subcmd__stop_commands() { | |||
| 494 | local commands; commands=() | 490 | local commands; commands=() |
| 495 | _describe -t commands 'rsp help stop commands' commands "$@" | 491 | _describe -t commands 'rsp help stop commands' commands "$@" |
| 496 | } | 492 | } |
| 497 | (( $+functions[_rsp__subcmd__help__subcmd__stop-playback_commands] )) || | 493 | (( $+functions[_rsp__subcmd__help__subcmd__stop-daemon_commands] )) || |
| 498 | _rsp__subcmd__help__subcmd__stop-playback_commands() { | 494 | _rsp__subcmd__help__subcmd__stop-daemon_commands() { |
| 499 | local commands; commands=() | 495 | local commands; commands=() |
| 500 | _describe -t commands 'rsp help stop-playback commands' commands "$@" | 496 | _describe -t commands 'rsp help stop-daemon commands' commands "$@" |
| 501 | } | 497 | } |
| 502 | (( $+functions[_rsp__subcmd__help__subcmd__toggle_commands] )) || | 498 | (( $+functions[_rsp__subcmd__help__subcmd__toggle_commands] )) || |
| 503 | _rsp__subcmd__help__subcmd__toggle_commands() { | 499 | _rsp__subcmd__help__subcmd__toggle_commands() { |
| @@ -621,10 +617,10 @@ _rsp__subcmd__shuffle_commands() { | |||
| 621 | local commands; commands=() | 617 | local commands; commands=() |
| 622 | _describe -t commands 'rsp shuffle commands' commands "$@" | 618 | _describe -t commands 'rsp shuffle commands' commands "$@" |
| 623 | } | 619 | } |
| 624 | (( $+functions[_rsp__subcmd__start_commands] )) || | 620 | (( $+functions[_rsp__subcmd__start-daemon_commands] )) || |
| 625 | _rsp__subcmd__start_commands() { | 621 | _rsp__subcmd__start-daemon_commands() { |
| 626 | local commands; commands=() | 622 | local commands; commands=() |
| 627 | _describe -t commands 'rsp start commands' commands "$@" | 623 | _describe -t commands 'rsp start-daemon commands' commands "$@" |
| 628 | } | 624 | } |
| 629 | (( $+functions[_rsp__subcmd__status_commands] )) || | 625 | (( $+functions[_rsp__subcmd__status_commands] )) || |
| 630 | _rsp__subcmd__status_commands() { | 626 | _rsp__subcmd__status_commands() { |
| @@ -636,10 +632,10 @@ _rsp__subcmd__stop_commands() { | |||
| 636 | local commands; commands=() | 632 | local commands; commands=() |
| 637 | _describe -t commands 'rsp stop commands' commands "$@" | 633 | _describe -t commands 'rsp stop commands' commands "$@" |
| 638 | } | 634 | } |
| 639 | (( $+functions[_rsp__subcmd__stop-playback_commands] )) || | 635 | (( $+functions[_rsp__subcmd__stop-daemon_commands] )) || |
| 640 | _rsp__subcmd__stop-playback_commands() { | 636 | _rsp__subcmd__stop-daemon_commands() { |
| 641 | local commands; commands=() | 637 | local commands; commands=() |
| 642 | _describe -t commands 'rsp stop-playback commands' commands "$@" | 638 | _describe -t commands 'rsp stop-daemon commands' commands "$@" |
| 643 | } | 639 | } |
| 644 | (( $+functions[_rsp__subcmd__toggle_commands] )) || | 640 | (( $+functions[_rsp__subcmd__toggle_commands] )) || |
| 645 | _rsp__subcmd__toggle_commands() { | 641 | _rsp__subcmd__toggle_commands() { |
| @@ -657,9 +653,3 @@ if [ "$funcstack[1]" = "_rsp" ]; then | |||
| 657 | else | 653 | else |
| 658 | compdef _rsp rsp | 654 | compdef _rsp rsp |
| 659 | fi | 655 | 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 | } | ||
