]> code.delx.au - pulseaudio/blobdiff - shell-completion/pulseaudio-zsh-completion.zsh
zsh-completion: Fix pacat device completion
[pulseaudio] / shell-completion / pulseaudio-zsh-completion.zsh
index 4a859569f04e5917c52537f598c25d5bbf19fc1a..e872736f3b8724b3c87dccad0e493cbc20f67618 100644 (file)
@@ -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
@@ -329,6 +345,7 @@ _pacmd_completion() {
         _pacmd_commands=(
             'help: show help and exit'
             'list-modules: list modules'
+            'list-cards: list cards'
             'list-sinks: list sinks'
             'list-sources: list sources'
             'list-clients: list clients'
@@ -470,8 +487,9 @@ _pacat_completion() {
         '--property=[set the specified property]:property' \
         '--raw[record/play raw PCM data]' \
         '--passthrough[passtrough data]' \
-        '--file-format[record/play formatted PCM data]:format:_pacat_file_formats' \
+        '--file-format=[record/play formatted PCM data]:format:_pacat_file_formats' \
         '--list-file-formats[list available formats]' \
+        '::files:_files' \
 }
 
 # TODO log-target file completion