diff options
author | poljar (Damir Jelić) <poljarinho@gmail.com> | 2013-08-15 14:08:43 +0200 |
---|---|---|
committer | Tanu Kaskinen <tanu.kaskinen@linux.intel.com> | 2013-10-29 19:47:06 +0200 |
commit | b49298c51ee2fe45ea2556b749ad0952f7580e7c (patch) | |
tree | ca446b5523d7374679364d57e62b7dece8e82545 /shell-completion | |
parent | 47729c43b4b0e59bac5858e66f851ad01aa44c68 (diff) |
zsh-completion: Fix pacat device completion
The pacat completion didn't complete the right devices for the --record
and --playback flags.
This patch fixes this and makes the device completion for pacat easily
expandable.
Diffstat (limited to 'shell-completion')
-rw-r--r-- | shell-completion/pulseaudio-zsh-completion.zsh | 38 |
1 files changed, 27 insertions, 11 deletions
diff --git a/shell-completion/pulseaudio-zsh-completion.zsh b/shell-completion/pulseaudio-zsh-completion.zsh index 142d0314d..e872736f3 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 |