[pulseaudio-discuss] [PATCH 5/6] shell-completion: zsh: Use -S and -A with _arguments

Tanu Kaskinen tanu.kaskinen at linux.intel.com
Sat Aug 16 04:48:18 PDT 2014


-S makes the option parser to not try parsing arguments as options
after "--" has appeared in the command line.

-A "-*" makes the option parser to not try parsing arguments as
options after the first non-option argument. The "-*" pattern means
that if there are unrecognized parameters that look like options
(i.e. start with a dash), those should not terminate the option
parsing.
---
 shell-completion/pulseaudio-zsh-completion.zsh | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/shell-completion/pulseaudio-zsh-completion.zsh b/shell-completion/pulseaudio-zsh-completion.zsh
index b993e85..77abe2b 100644
--- a/shell-completion/pulseaudio-zsh-completion.zsh
+++ b/shell-completion/pulseaudio-zsh-completion.zsh
@@ -275,7 +275,7 @@ _pactl_completion() {
         'cards: list available cards'
     )
 
-    _arguments -C \
+    _arguments -C -S -A '-*' \
         {-h,--help}'[display help and exit]' \
         '--version[show version and exit]' \
         {-s,--server}'[name of server to connect to]:host:_hosts' \
@@ -369,7 +369,7 @@ _pacmd_completion() {
         _describe 'pacmd commands' _pacmd_commands
     }
 
-    _arguments -C \
+    _arguments -C -S -A "-*" \
         {-h,--help}'[display help and exit]' \
         '--version[show version and exit]' \
         '::pacmd commands:_pacmd_command' \
@@ -403,14 +403,14 @@ _pacmd_completion() {
 }
 
 _pasuspender_completion() {
-    _arguments -C \
+    _arguments -S -A "-*" -C \
         {-h,--help}'[display help and exit]' \
         '--version[show version and exit]' \
         {-s,--server}'[name of server to connect to]:host:_hosts' \
 }
 
 _padsp_completion() {
-    _arguments -C \
+    _arguments -C -S -A "-*" \
         '-h[display help and exit]' \
         '-s[name of server to connect to]:host:_hosts' \
         '-n[client name to use]:name:' \
@@ -429,7 +429,7 @@ _pacat_completion() {
     _pacat_sample_formats=('s16le' 's16be' 'u8' 'float32le' 'float32be'
         'ulaw' 'alaw' 's32le' 's32be' 's24le' 's24-32le' 's24-32be')
 
-    _arguments -C \
+    _arguments -C -S -A "-*" \
         {-h,--help}'[display this help and exit]' \
         '--version[show version and exit]' \
         {-r,--record}'[create a connection for recording]' \
-- 
1.9.3



More information about the pulseaudio-discuss mailing list