diff options
author | Sven Wischnowsky <wischnow@users.sourceforge.net> | 2000-04-11 07:57:56 +0000 |
---|---|---|
committer | Sven Wischnowsky <wischnow@users.sourceforge.net> | 2000-04-11 07:57:56 +0000 |
commit | fac3086d9782e73dcaf1aa65fd36a0b63a374719 (patch) | |
tree | 7bab35e2787ca17f02ec932dffae1bfff2ffcfe3 /Completion/User/_socket | |
parent | 37012f06a7e5e8a64614dbf9032c77cff1bcfcfb (diff) | |
download | zsh-fac3086d9782e73dcaf1aa65fd36a0b63a374719.tar.gz zsh-fac3086d9782e73dcaf1aa65fd36a0b63a374719.tar.xz zsh-fac3086d9782e73dcaf1aa65fd36a0b63a374719.zip |
_wanted now tests both tags and labels; change places where _wanted was called without a command; allow multiple patterns per string in file-patterns; update _next_tags to work with labels (10632)
Diffstat (limited to 'Completion/User/_socket')
-rw-r--r-- | Completion/User/_socket | 49 |
1 files changed, 35 insertions, 14 deletions
diff --git a/Completion/User/_socket b/Completion/User/_socket index 353a66fd5..af9c8ab0a 100644 --- a/Completion/User/_socket +++ b/Completion/User/_socket @@ -1,34 +1,55 @@ #compdef socket -local state line expl -typeset -A options +# Style used: +# +# hosts-ports +# The style that contains pairs `host:port'. -_arguments -s \ - -{b,c,f,q,r,v,w} \ - -{s,l} \ - '-p:command:->command' \ +local curcontext="$curcontext" state line expl +typeset -A opt_args + +[[ $CURRENT -eq 2 ]] && + { ! zstyle -T ":completion:${curcontext}:options" prefix-needed || + [[ "$PREFIX" = -* ]] } && + _wanted options expl option \ + compadd -M 'r:|[_-]=* r:|=*' "$expl[@]" - -version + +_arguments -C -s \ + '-b[background]' \ + '-c[crlf]' \ + '-f[fork]' \ + '-q[quit]' \ + '-r[read only]' \ + '-v[verbose]' \ + '-w[write only]' \ + '-s[server]' \ + '-l[loop]' \ + '-p[program]:command:->command' \ ':arg1:->arg1' \ ':arg2:->arg2' case "$state" in command) compset -q - _normal + if [[ $CURRENT -eq 1 ]]; then + _command_names -e "$@" + else + _normal + fi ;; arg1) - if (( $+options[-s] )); then - _message 'port' + if (( $+opt_args[-s] )); then + _ports else - _description expl 'host' - _hosts "$expl[@]" + _wanted hosts expl 'host' _combination '' hosts-ports hosts - fi ;; arg2) - if (( ! $+options[-s] )); then - _description expl 'port' - _hostports $line[2] "$expl[@]" + if (( ! $+opt_args[-s] )); then + _wanted ports expl 'port to connect' \ + _combination '' hosts-ports hosts="${line[1]:q}" ports - fi ;; esac |