[pulseaudio-discuss] [PATCH 4/6] shell-completion: zsh: Don't use multiple option sets for one command
Tanu Kaskinen
tanu.kaskinen at linux.intel.com
Sat Aug 16 04:48:17 PDT 2014
Dividing the options to multiple sets was misguided (I don't know what
the original motivation was). For example, with pacat the -s and
--server options were specified as one set. It meant that after the
user had written "pactl --server foo", further completions stopped to
work. The "server" option set didn't contain any other options, so
once Zsh detected that the "server" option set was in use, it thought
that no other options were valid.
The special casing for "-s", "-n", "--server" and "--client-*" at the
end of _pactl_completion() was probably an attempt to deal with this
problem. Those special cases are unnecessary now that the option
specification given to _arguments is more correct.
---
shell-completion/pulseaudio-zsh-completion.zsh | 16 +++++-----------
1 file changed, 5 insertions(+), 11 deletions(-)
diff --git a/shell-completion/pulseaudio-zsh-completion.zsh b/shell-completion/pulseaudio-zsh-completion.zsh
index d58ab47..b993e85 100644
--- a/shell-completion/pulseaudio-zsh-completion.zsh
+++ b/shell-completion/pulseaudio-zsh-completion.zsh
@@ -276,14 +276,11 @@ _pactl_completion() {
)
_arguments -C \
- - '(help)' \
- {-h,--help}'[display help and exit]' \
+ {-h,--help}'[display help and exit]' \
'--version[show version and exit]' \
- - '(server)' \
- {-s,--server}'[name of server to connect to]:host:_hosts' \
- - '(name)' \
- {-n,--client-name}'[client name to use]:name' \
- '::pactl commands:_pactl_command' \
+ {-s,--server}'[name of server to connect to]:host:_hosts' \
+ {-n,--client-name}'[client name to use]:name' \
+ '::pactl command:_pactl_command'
case $words[$((CURRENT - 1))] in
list) _describe 'pactl list commands' _pactl_list_commands;;
@@ -307,8 +304,6 @@ _pactl_completion() {
suspend-*) compadd true false;;
list) compadd short;;
move-*) _devices;;
- '-s' | '-n') _pactl_command;;
- --server | --client-*) _pactl_command;;
esac
}
@@ -375,8 +370,7 @@ _pacmd_completion() {
}
_arguments -C \
- - '(help)' \
- {-h,--help}'[display help and exit]' \
+ {-h,--help}'[display help and exit]' \
'--version[show version and exit]' \
'::pacmd commands:_pacmd_command' \
--
1.9.3
More information about the pulseaudio-discuss
mailing list