X-Git-Url: https://code.delx.au/pulseaudio/blobdiff_plain/47729c43b4b0e59bac5858e66f851ad01aa44c68..b49298c51ee2fe45ea2556b749ad0952f7580e7c:/shell-completion/pulseaudio-zsh-completion.zsh diff --git a/shell-completion/pulseaudio-zsh-completion.zsh b/shell-completion/pulseaudio-zsh-completion.zsh index 142d0314..e872736f 100644 --- a/shell-completion/pulseaudio-zsh-completion.zsh +++ b/shell-completion/pulseaudio-zsh-completion.zsh @@ -24,18 +24,34 @@ _devices() { esac elif [[ $service == (pacat|paplay|parecord) ]]; then - if [[ $words == *-r[[:space:]]* ]]; then - cmd=('sources') - elif [[ $words == *-p[[:space:]]* ]]; then - cmd=('sinks') - else - cmd=('sinks' 'sources') - fi + case $words[$((CURRENT))] in + --device=*) + if [[ $words == *(--playback|-p)[[:space:]]* || + $service == paplay ]]; then + cmd=('sinks') + elif [[ $words == *(--record|-r)[[:space:]]* || + $service == parecord ]]; then + cmd=('sources') + else + cmd=('sinks' 'sources') + fi + ;; + esac + + case $words[$((CURRENT - 1))] in + -d) + if [[ $words == *(--playback|-p)[[:space:]]* || + $service == paplay ]]; then + cmd=('sinks') + elif [[ $words == *(--record|-r)[[:space:]]* || + $service == parecord ]]; then + cmd=('sources') + else + cmd=('sinks' 'sources') + fi + ;; + esac - elif [[ $service == paplay ]]; then - cmd=('sinks') - elif [[ $service == parecord ]]; then - cmd=('sources') fi for (( i = 0; i < ${#words[@]}; i++ )) do