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.zsh | 70 +++++++++++++++++++++++------------------------------ 1 file changed, 30 insertions(+), 40 deletions(-) (limited to 'completions/rsp.zsh') 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() { (( CURRENT += 1 )) curcontext="${curcontext%:*:*}:rsp-command-$line[1]:" case $line[1] in - (start) + (start-daemon) _arguments "${_arguments_options[@]}" : \ '-h[Print help]' \ '--help[Print help]' \ && ret=0 ;; -(stop) +(stop-daemon) _arguments "${_arguments_options[@]}" : \ '-h[Print help]' \ '--help[Print help]' \ @@ -46,17 +46,13 @@ _arguments "${_arguments_options[@]}" : \ ;; (play) _arguments "${_arguments_options[@]}" : \ -'-i[Play immediately (add after current and skip to it)]' \ -'--now[Play immediately (add after current and skip to it)]' \ +'-i[Add after current track and skip to it]' \ +'--now[Add after current track and skip to it]' \ '-n[Add to queue after current track (don'\''t skip)]' \ '--next[Add to queue after current track (don'\''t skip)]' \ -'-l[Add to end of queue (default)]' \ -'--last[Add to end of queue (default)]' \ -'-L[List available artists/albums]' \ -'--list[List available artists/albums]' \ '-h[Print help]' \ '--help[Print help]' \ -'::query -- Artist/Album or local file path:_rsp_play_artist_album_completion' \ +'::query:_default' \ && ret=0 ;; (pause) @@ -77,7 +73,7 @@ _arguments "${_arguments_options[@]}" : \ '--help[Print help]' \ && ret=0 ;; -(stop-playback) +(stop) _arguments "${_arguments_options[@]}" : \ '-h[Print help]' \ '--help[Print help]' \ @@ -215,9 +211,9 @@ esac ;; (completions) _arguments "${_arguments_options[@]}" : \ -'--shell=[Also print to stdout for a specific shell]:SHELL:(bash elvish fish powershell zsh)' \ '-h[Print help]' \ '--help[Print help]' \ +'::shell -- Shell to generate (bash, zsh, fish, elvish, powershell) If not specified, generates all completion files:_default' \ && ret=0 ;; (help) @@ -232,11 +228,11 @@ _arguments "${_arguments_options[@]}" : \ (( CURRENT += 1 )) curcontext="${curcontext%:*:*}:rsp-help-command-$line[1]:" case $line[1] in - (start) + (start-daemon) _arguments "${_arguments_options[@]}" : \ && ret=0 ;; -(stop) +(stop-daemon) _arguments "${_arguments_options[@]}" : \ && ret=0 ;; @@ -260,7 +256,7 @@ _arguments "${_arguments_options[@]}" : \ _arguments "${_arguments_options[@]}" : \ && ret=0 ;; -(stop-playback) +(stop) _arguments "${_arguments_options[@]}" : \ && ret=0 ;; @@ -344,14 +340,14 @@ esac (( $+functions[_rsp_commands] )) || _rsp_commands() { local commands; commands=( -'start:Start the daemon' \ -'stop:Stop the daemon' \ +'start-daemon:Start the daemon' \ +'stop-daemon:Stop the daemon' \ 'restart:Restart the daemon (kill existing and start new)' \ 'play:Play a track, album, or artist' \ 'pause:Pause playback' \ 'resume:Resume playback' \ 'toggle:Toggle play/pause' \ -'stop-playback:Stop playback' \ +'stop:Stop playback' \ 'next:Skip to next track' \ 'previous:Skip to previous track' \ 'volume:Set volume (0-100)' \ @@ -360,7 +356,7 @@ _rsp_commands() { 'status:Show player status' \ 'scan:Scan music paths to populate database' \ 'settings:Settings management' \ -'completions:Generate shell completions and write to completions/ directory (bash, elvish, fish, powershell, zsh)' \ +'completions:Generate shell completions (developer only)' \ 'help:Print this message or the help of the given subcommand(s)' \ ) _describe -t commands 'rsp commands' commands "$@" @@ -373,14 +369,14 @@ _rsp__subcmd__completions_commands() { (( $+functions[_rsp__subcmd__help_commands] )) || _rsp__subcmd__help_commands() { local commands; commands=( -'start:Start the daemon' \ -'stop:Stop the daemon' \ +'start-daemon:Start the daemon' \ +'stop-daemon:Stop the daemon' \ 'restart:Restart the daemon (kill existing and start new)' \ 'play:Play a track, album, or artist' \ 'pause:Pause playback' \ 'resume:Resume playback' \ 'toggle:Toggle play/pause' \ -'stop-playback:Stop playback' \ +'stop:Stop playback' \ 'next:Skip to next track' \ 'previous:Skip to previous track' \ 'volume:Set volume (0-100)' \ @@ -389,7 +385,7 @@ _rsp__subcmd__help_commands() { 'status:Show player status' \ 'scan:Scan music paths to populate database' \ 'settings:Settings management' \ -'completions:Generate shell completions and write to completions/ directory (bash, elvish, fish, powershell, zsh)' \ +'completions:Generate shell completions (developer only)' \ 'help:Print this message or the help of the given subcommand(s)' \ ) _describe -t commands 'rsp help commands' commands "$@" @@ -479,10 +475,10 @@ _rsp__subcmd__help__subcmd__shuffle_commands() { local commands; commands=() _describe -t commands 'rsp help shuffle commands' commands "$@" } -(( $+functions[_rsp__subcmd__help__subcmd__start_commands] )) || -_rsp__subcmd__help__subcmd__start_commands() { +(( $+functions[_rsp__subcmd__help__subcmd__start-daemon_commands] )) || +_rsp__subcmd__help__subcmd__start-daemon_commands() { local commands; commands=() - _describe -t commands 'rsp help start commands' commands "$@" + _describe -t commands 'rsp help start-daemon commands' commands "$@" } (( $+functions[_rsp__subcmd__help__subcmd__status_commands] )) || _rsp__subcmd__help__subcmd__status_commands() { @@ -494,10 +490,10 @@ _rsp__subcmd__help__subcmd__stop_commands() { local commands; commands=() _describe -t commands 'rsp help stop commands' commands "$@" } -(( $+functions[_rsp__subcmd__help__subcmd__stop-playback_commands] )) || -_rsp__subcmd__help__subcmd__stop-playback_commands() { +(( $+functions[_rsp__subcmd__help__subcmd__stop-daemon_commands] )) || +_rsp__subcmd__help__subcmd__stop-daemon_commands() { local commands; commands=() - _describe -t commands 'rsp help stop-playback commands' commands "$@" + _describe -t commands 'rsp help stop-daemon commands' commands "$@" } (( $+functions[_rsp__subcmd__help__subcmd__toggle_commands] )) || _rsp__subcmd__help__subcmd__toggle_commands() { @@ -621,10 +617,10 @@ _rsp__subcmd__shuffle_commands() { local commands; commands=() _describe -t commands 'rsp shuffle commands' commands "$@" } -(( $+functions[_rsp__subcmd__start_commands] )) || -_rsp__subcmd__start_commands() { +(( $+functions[_rsp__subcmd__start-daemon_commands] )) || +_rsp__subcmd__start-daemon_commands() { local commands; commands=() - _describe -t commands 'rsp start commands' commands "$@" + _describe -t commands 'rsp start-daemon commands' commands "$@" } (( $+functions[_rsp__subcmd__status_commands] )) || _rsp__subcmd__status_commands() { @@ -636,10 +632,10 @@ _rsp__subcmd__stop_commands() { local commands; commands=() _describe -t commands 'rsp stop commands' commands "$@" } -(( $+functions[_rsp__subcmd__stop-playback_commands] )) || -_rsp__subcmd__stop-playback_commands() { +(( $+functions[_rsp__subcmd__stop-daemon_commands] )) || +_rsp__subcmd__stop-daemon_commands() { local commands; commands=() - _describe -t commands 'rsp stop-playback commands' commands "$@" + _describe -t commands 'rsp stop-daemon commands' commands "$@" } (( $+functions[_rsp__subcmd__toggle_commands] )) || _rsp__subcmd__toggle_commands() { @@ -657,9 +653,3 @@ if [ "$funcstack[1]" = "_rsp" ]; then else compdef _rsp rsp fi - -_rsp_play_artist_album_completion() { - local -a artists - artists=("$(rsp play --list 2>/dev/null)") - _describe -t artist-album 'artist/album' artists -} -- cgit v1.2.3