aboutsummaryrefslogtreecommitdiffstats
path: root/completions/rsp.bash
diff options
context:
space:
mode:
authorsalmonik <raisersoft@proton.me>2026-05-13 11:27:16 +0200
committersalmonik <raisersoft@proton.me>2026-05-13 11:27:16 +0200
commit1059d878476c231f84ef9d3c2e8bcafaf978bc87 (patch)
tree91a5ac153299764efcb8cf439ca7751152a34274 /completions/rsp.bash
parentAdd display_format config, fix restart command, clean up config code (diff)
downloadrsplayer-1059d878476c231f84ef9d3c2e8bcafaf978bc87.tar.gz
rsplayer-1059d878476c231f84ef9d3c2e8bcafaf978bc87.zip
Regenerate shell completions and install script fixes
- Add hidden completions subcommand to CLI (developer use only) - Regenerate all completion scripts from current CLI structure - Add elvish and powershell completion scripts - install.sh: Fix rsp stop -> rsp stop-daemon, rsp start -> rsp start-daemon - install.sh: Install completions for user's current shell - install.sh: Zsh uses /usr/share/zsh/site-functions/_rsp directly
Diffstat (limited to 'completions/rsp.bash')
-rw-r--r--completions/rsp.bash52
1 files changed, 17 insertions, 35 deletions
diff --git a/completions/rsp.bash b/completions/rsp.bash
index 4ea8603..1812802 100644
--- a/completions/rsp.bash
+++ b/completions/rsp.bash
@@ -1,14 +1,3 @@
1_rsp_play_query_completions() {
2 local cur="${COMP_WORDS[COMP_CWORD]}"
3 # Only do dynamic completion if COMPREPLY is empty (no flag matched)
4 # and the current word doesn't start with -
5 if [[ ${#COMPREPLY[@]} -eq 0 && "$cur" != -* ]]; then
6 local -a artists
7 artists=($(rsp play --list 2>/dev/null))
8 COMPREPLY=( $(compgen -W "${artists[*]}" -- "$cur") )
9 fi
10}
11
12_rsp() { 1_rsp() {
13 local i cur prev opts cmd 2 local i cur prev opts cmd
14 COMPREPLY=() 3 COMPREPLY=()
@@ -63,8 +52,8 @@ _rsp() {
63 rsp,shuffle) 52 rsp,shuffle)
64 cmd="rsp__subcmd__shuffle" 53 cmd="rsp__subcmd__shuffle"
65 ;; 54 ;;
66 rsp,start) 55 rsp,start-daemon)
67 cmd="rsp__subcmd__start" 56 cmd="rsp__subcmd__start__subcmd__daemon"
68 ;; 57 ;;
69 rsp,status) 58 rsp,status)
70 cmd="rsp__subcmd__status" 59 cmd="rsp__subcmd__status"
@@ -72,8 +61,8 @@ _rsp() {
72 rsp,stop) 61 rsp,stop)
73 cmd="rsp__subcmd__stop" 62 cmd="rsp__subcmd__stop"
74 ;; 63 ;;
75 rsp,stop-playback) 64 rsp,stop-daemon)
76 cmd="rsp__subcmd__stop__subcmd__playback" 65 cmd="rsp__subcmd__stop__subcmd__daemon"
77 ;; 66 ;;
78 rsp,toggle) 67 rsp,toggle)
79 cmd="rsp__subcmd__toggle" 68 cmd="rsp__subcmd__toggle"
@@ -117,8 +106,8 @@ _rsp() {
117 rsp__subcmd__help,shuffle) 106 rsp__subcmd__help,shuffle)
118 cmd="rsp__subcmd__help__subcmd__shuffle" 107 cmd="rsp__subcmd__help__subcmd__shuffle"
119 ;; 108 ;;
120 rsp__subcmd__help,start) 109 rsp__subcmd__help,start-daemon)
121 cmd="rsp__subcmd__help__subcmd__start" 110 cmd="rsp__subcmd__help__subcmd__start__subcmd__daemon"
122 ;; 111 ;;
123 rsp__subcmd__help,status) 112 rsp__subcmd__help,status)
124 cmd="rsp__subcmd__help__subcmd__status" 113 cmd="rsp__subcmd__help__subcmd__status"
@@ -126,8 +115,8 @@ _rsp() {
126 rsp__subcmd__help,stop) 115 rsp__subcmd__help,stop)
127 cmd="rsp__subcmd__help__subcmd__stop" 116 cmd="rsp__subcmd__help__subcmd__stop"
128 ;; 117 ;;
129 rsp__subcmd__help,stop-playback) 118 rsp__subcmd__help,stop-daemon)
130 cmd="rsp__subcmd__help__subcmd__stop__subcmd__playback" 119 cmd="rsp__subcmd__help__subcmd__stop__subcmd__daemon"
131 ;; 120 ;;
132 rsp__subcmd__help,toggle) 121 rsp__subcmd__help,toggle)
133 cmd="rsp__subcmd__help__subcmd__toggle" 122 cmd="rsp__subcmd__help__subcmd__toggle"
@@ -184,7 +173,7 @@ _rsp() {
184 173
185 case "${cmd}" in 174 case "${cmd}" in
186 rsp) 175 rsp)
187 opts="-h --help start stop restart play pause resume toggle stop-playback next previous volume shuffle queue status scan settings completions help" 176 opts="-h --help start-daemon stop-daemon restart play pause resume toggle stop next previous volume shuffle queue status scan settings completions help"
188 if [[ ${cur} == -* || ${COMP_CWORD} -eq 1 ]] ; then 177 if [[ ${cur} == -* || ${COMP_CWORD} -eq 1 ]] ; then
189 COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) 178 COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
190 return 0 179 return 0
@@ -198,16 +187,12 @@ _rsp() {
198 return 0 187 return 0
199 ;; 188 ;;
200 rsp__subcmd__completions) 189 rsp__subcmd__completions)
201 opts="-h --shell --help" 190 opts="-h --help [SHELL]"
202 if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then 191 if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
203 COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) 192 COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
204 return 0 193 return 0
205 fi 194 fi
206 case "${prev}" in 195 case "${prev}" in
207 --shell)
208 COMPREPLY=($(compgen -W "bash elvish fish powershell zsh" -- "${cur}"))
209 return 0
210 ;;
211 *) 196 *)
212 COMPREPLY=() 197 COMPREPLY=()
213 ;; 198 ;;
@@ -216,7 +201,7 @@ _rsp() {
216 return 0 201 return 0
217 ;; 202 ;;
218 rsp__subcmd__help) 203 rsp__subcmd__help)
219 opts="start stop restart play pause resume toggle stop-playback next previous volume shuffle queue status scan settings completions help" 204 opts="start-daemon stop-daemon restart play pause resume toggle stop next previous volume shuffle queue status scan settings completions help"
220 if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then 205 if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
221 COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) 206 COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
222 return 0 207 return 0
@@ -453,7 +438,7 @@ _rsp() {
453 COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) 438 COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
454 return 0 439 return 0
455 ;; 440 ;;
456 rsp__subcmd__help__subcmd__start) 441 rsp__subcmd__help__subcmd__start__subcmd__daemon)
457 opts="" 442 opts=""
458 if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then 443 if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then
459 COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) 444 COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
@@ -495,7 +480,7 @@ _rsp() {
495 COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) 480 COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
496 return 0 481 return 0
497 ;; 482 ;;
498 rsp__subcmd__help__subcmd__stop__subcmd__playback) 483 rsp__subcmd__help__subcmd__stop__subcmd__daemon)
499 opts="" 484 opts=""
500 if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then 485 if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then
501 COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) 486 COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
@@ -566,7 +551,7 @@ _rsp() {
566 return 0 551 return 0
567 ;; 552 ;;
568 rsp__subcmd__play) 553 rsp__subcmd__play)
569 opts="-i -n -l -L -h --now --next --last --list --help [QUERY]" 554 opts="-i -n -h --now --next --help [QUERY]"
570 if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then 555 if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
571 COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) 556 COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
572 return 0 557 return 0
@@ -577,10 +562,7 @@ _rsp() {
577 ;; 562 ;;
578 esac 563 esac
579 COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) 564 COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
580 565 return 0
581 # Dynamic artist/album completion for query argument
582 _rsp_play_query_completions
583return 0
584 ;; 566 ;;
585 rsp__subcmd__previous) 567 rsp__subcmd__previous)
586 opts="-h --help" 568 opts="-h --help"
@@ -824,7 +806,7 @@ return 0
824 COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) 806 COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
825 return 0 807 return 0
826 ;; 808 ;;
827 rsp__subcmd__start) 809 rsp__subcmd__start__subcmd__daemon)
828 opts="-h --help" 810 opts="-h --help"
829 if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then 811 if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
830 COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) 812 COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
@@ -866,7 +848,7 @@ return 0
866 COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) 848 COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
867 return 0 849 return 0
868 ;; 850 ;;
869 rsp__subcmd__stop__subcmd__playback) 851 rsp__subcmd__stop__subcmd__daemon)
870 opts="-h --help" 852 opts="-h --help"
871 if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then 853 if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
872 COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) 854 COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )