]> code.delx.au - pulseaudio/blobdiff - shell-completion/pulseaudio-zsh-completion.zsh
pactl: Stop parsing option when the first non-option is encountered
[pulseaudio] / shell-completion / pulseaudio-zsh-completion.zsh
index 142d0314d032bcda2cf09085b301b084f7ee83e5..abc443a4198fbb75616edadf90d818db0caad7ae 100644 (file)
@@ -24,18 +24,35 @@ _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
+                ;;
+            --monitor-stream=*) cmd=('sink-inputs');;
+        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
@@ -452,6 +469,7 @@ _pacat_completion() {
         {-p,--playback}'[create a connection for playback]' \
         {-s,--server=}'[name of server to connect to]:host:_hosts' \
         {-d,--device=}'[name of sink/source to connect to]:device:_devices' \
+        '--monitor-stream=[index of the sink input to record from]:device:_devices' \
         {-n,--client-name=}'[client name to use]:name' \
         '--stream-name=[how to call this stream]:name' \
         '--volume=[initial volume to use]:volume' \