[pulseaudio-commits] Branch 'next' - shell-completion/zsh
Tanu Kaskinen
tanuk at kemper.freedesktop.org
Thu Nov 10 16:00:10 UTC 2016
shell-completion/zsh/_pulseaudio | 24 ++++++++++++++++++++----
1 file changed, 20 insertions(+), 4 deletions(-)
New commits:
commit 907a3937b86e53f4e6fc58d85eb4a65e88f5614a
Author: Paul Seyfert <paul.seyfert at mib.infn.it>
Date: Tue Nov 8 12:28:55 2016 +0100
shell-completion: update zsh completion for pasuspender
* remove suggestion of '-C' due to incorrect ordering of options for
_arguments
* avoid suggesting multiple options
* add suggestion of "--", followed by executable programs
* after "--server=<hostname>" or "-s <hostname>" suggest "--"
* after "-- <program>" continue standard tab completion
BugLink: https://bugs.freedesktop.org/show_bug.cgi?id=98639
diff --git a/shell-completion/zsh/_pulseaudio b/shell-completion/zsh/_pulseaudio
index e065085..0e9e89b 100644
--- a/shell-completion/zsh/_pulseaudio
+++ b/shell-completion/zsh/_pulseaudio
@@ -600,10 +600,26 @@ _pacmd_completion() {
}
_pasuspender_completion() {
- _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' \
+ # parenthesis expressions specify which options should not get suggested afterwards
+ # e.g. after -s, help and version will not get suggested, -- remains the only valid argument
+ # after "--" external commands get suggested
+ _arguments -C \
+ '(-)'{-h,--help}'[display help and exit]' \
+ '(-)--version[show version and exit]' \
+ '(-h --help --version -s --server)'{-s,--server=}'[name of server to connect to]:host:_hosts' \
+ '(-)--[program]:program: _command_names -e' && return 0
+ # check if "--" is one of the words in the command line
+ # if so, ${words[(i)--]} is the position of "--"
+ # shift the arguments and reduce CURRENT, such that further completions see only what follows "--"
+ if [[ ${words[(r)--]} == "--" ]]; then
+ for ((j = ${words[(i)--]}; j > 0; j--));
+ do
+ shift words
+ (( CURRENT-- ))
+ done
+ # proceed with normal completion
+ _normal
+ fi
}
_padsp_completion() {
More information about the pulseaudio-commits
mailing list