From 1059d878476c231f84ef9d3c2e8bcafaf978bc87 Mon Sep 17 00:00:00 2001 From: salmonik Date: Wed, 13 May 2026 11:27:16 +0200 Subject: 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 --- completions/rsp.bash | 52 +++++++++++++++++----------------------------------- 1 file changed, 17 insertions(+), 35 deletions(-) (limited to 'completions/rsp.bash') 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 @@ -_rsp_play_query_completions() { - local cur="${COMP_WORDS[COMP_CWORD]}" - # Only do dynamic completion if COMPREPLY is empty (no flag matched) - # and the current word doesn't start with - - if [[ ${#COMPREPLY[@]} -eq 0 && "$cur" != -* ]]; then - local -a artists - artists=($(rsp play --list 2>/dev/null)) - COMPREPLY=( $(compgen -W "${artists[*]}" -- "$cur") ) - fi -} - _rsp() { local i cur prev opts cmd COMPREPLY=() @@ -63,8 +52,8 @@ _rsp() { rsp,shuffle) cmd="rsp__subcmd__shuffle" ;; - rsp,start) - cmd="rsp__subcmd__start" + rsp,start-daemon) + cmd="rsp__subcmd__start__subcmd__daemon" ;; rsp,status) cmd="rsp__subcmd__status" @@ -72,8 +61,8 @@ _rsp() { rsp,stop) cmd="rsp__subcmd__stop" ;; - rsp,stop-playback) - cmd="rsp__subcmd__stop__subcmd__playback" + rsp,stop-daemon) + cmd="rsp__subcmd__stop__subcmd__daemon" ;; rsp,toggle) cmd="rsp__subcmd__toggle" @@ -117,8 +106,8 @@ _rsp() { rsp__subcmd__help,shuffle) cmd="rsp__subcmd__help__subcmd__shuffle" ;; - rsp__subcmd__help,start) - cmd="rsp__subcmd__help__subcmd__start" + rsp__subcmd__help,start-daemon) + cmd="rsp__subcmd__help__subcmd__start__subcmd__daemon" ;; rsp__subcmd__help,status) cmd="rsp__subcmd__help__subcmd__status" @@ -126,8 +115,8 @@ _rsp() { rsp__subcmd__help,stop) cmd="rsp__subcmd__help__subcmd__stop" ;; - rsp__subcmd__help,stop-playback) - cmd="rsp__subcmd__help__subcmd__stop__subcmd__playback" + rsp__subcmd__help,stop-daemon) + cmd="rsp__subcmd__help__subcmd__stop__subcmd__daemon" ;; rsp__subcmd__help,toggle) cmd="rsp__subcmd__help__subcmd__toggle" @@ -184,7 +173,7 @@ _rsp() { case "${cmd}" in rsp) - opts="-h --help start stop restart play pause resume toggle stop-playback next previous volume shuffle queue status scan settings completions help" + opts="-h --help start-daemon stop-daemon restart play pause resume toggle stop next previous volume shuffle queue status scan settings completions help" if [[ ${cur} == -* || ${COMP_CWORD} -eq 1 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 @@ -198,16 +187,12 @@ _rsp() { return 0 ;; rsp__subcmd__completions) - opts="-h --shell --help" + opts="-h --help [SHELL]" if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 fi case "${prev}" in - --shell) - COMPREPLY=($(compgen -W "bash elvish fish powershell zsh" -- "${cur}")) - return 0 - ;; *) COMPREPLY=() ;; @@ -216,7 +201,7 @@ _rsp() { return 0 ;; rsp__subcmd__help) - opts="start stop restart play pause resume toggle stop-playback next previous volume shuffle queue status scan settings completions help" + opts="start-daemon stop-daemon restart play pause resume toggle stop next previous volume shuffle queue status scan settings completions help" if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 @@ -453,7 +438,7 @@ _rsp() { COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 ;; - rsp__subcmd__help__subcmd__start) + rsp__subcmd__help__subcmd__start__subcmd__daemon) opts="" if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) @@ -495,7 +480,7 @@ _rsp() { COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 ;; - rsp__subcmd__help__subcmd__stop__subcmd__playback) + rsp__subcmd__help__subcmd__stop__subcmd__daemon) opts="" if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) @@ -566,7 +551,7 @@ _rsp() { return 0 ;; rsp__subcmd__play) - opts="-i -n -l -L -h --now --next --last --list --help [QUERY]" + opts="-i -n -h --now --next --help [QUERY]" if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 @@ -577,10 +562,7 @@ _rsp() { ;; esac COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) - - # Dynamic artist/album completion for query argument - _rsp_play_query_completions -return 0 + return 0 ;; rsp__subcmd__previous) opts="-h --help" @@ -824,7 +806,7 @@ return 0 COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 ;; - rsp__subcmd__start) + rsp__subcmd__start__subcmd__daemon) opts="-h --help" if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) @@ -866,7 +848,7 @@ return 0 COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 ;; - rsp__subcmd__stop__subcmd__playback) + rsp__subcmd__stop__subcmd__daemon) opts="-h --help" if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) -- cgit v1.2.3