From 45cd289e494db22c177b7a4ecf795b5f0795026c Mon Sep 17 00:00:00 2001 From: Mikael Magnusson Date: Fri, 9 Dec 2011 14:51:54 +0000 Subject: 29876: Update getent completion. --- Completion/Unix/Command/_getent | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'Completion/Unix/Command') diff --git a/Completion/Unix/Command/_getent b/Completion/Unix/Command/_getent index 57d2ec256..9644fa35b 100755 --- a/Completion/Unix/Command/_getent +++ b/Completion/Unix/Command/_getent @@ -25,8 +25,9 @@ case $state in ;; databases) if [[ $is_gnu = gnu ]]; then - databases=( ${=${${(f)"$(_call_program databases $words[1] --help \ - 2>/dev/null)"}[(r)Supported*,-1]}[2,-1]} ) + databases=( "${(@)${(@f)$(_call_program databases $words[1] --help \ + 2>/dev/null)}[(r)Supported*,-1]}" ) + databases=( "${=${(@)databases[2,${(@)databases[(i)]}-1]}}" ) else databases=( passwd group hosts ipnodes services protocols ethers networks netmasks ) fi -- cgit v1.2.3 From 3e1146677f48dbeb697c2744266454d14d5289bb Mon Sep 17 00:00:00 2001 From: Simon Ruderich Date: Fri, 9 Dec 2011 22:32:52 +0000 Subject: 29917: Completion/Unix/Command/_ssh: Tabs to spaces. --- ChangeLog | 6 ++- Completion/Unix/Command/_ssh | 108 +++++++++++++++++++++---------------------- 2 files changed, 59 insertions(+), 55 deletions(-) (limited to 'Completion/Unix/Command') diff --git a/ChangeLog b/ChangeLog index dcc023f70..2b4b77b5d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2011-12-09 Simon Ruderich + + * 29917: Completion/Unix/Command/_ssh: Tabs to spaces. + 2011-12-09 Mikael Magnusson * unposted: Doc/Zsh/compsys.yo: Remove duplicated 'the'. @@ -15699,5 +15703,5 @@ ***************************************************** * This is used by the shell to define $ZSH_PATCHLEVEL -* $Revision: 1.5527 $ +* $Revision: 1.5528 $ ***************************************************** diff --git a/Completion/Unix/Command/_ssh b/Completion/Unix/Command/_ssh index 0ec9c84a0..bd23c3627 100644 --- a/Completion/Unix/Command/_ssh +++ b/Completion/Unix/Command/_ssh @@ -27,9 +27,9 @@ _remote_files () { while _tags; do while _next_label files expl ${suf:-remote directory}; do [[ -n $suf ]] && compadd "$@" "$expl[@]" -d remdispf \ - ${(q)remdispf%[*=@|]} && ret=0 - compadd ${suf:+-S/} "$@" "$expl[@]" -d remdispd \ - ${(q)remdispd%/} && ret=0 + ${(q)remdispf%[*=@|]} && ret=0 + compadd ${suf:+-S/} "$@" "$expl[@]" -d remdispd \ + ${(q)remdispd%/} && ret=0 done (( ret )) || return 0 done @@ -182,46 +182,46 @@ _ssh () { if compset -P '*[= ]'; then case "$IPREFIX" in *(#i)(afstokenpassing|batchmode|compression|fallbacktorsh|forward(agent|x11)|keepalive|passwordauthentication|rhosts(|rsa)authentication|rsaauthentication|usersh|kerberos(authetication|tgtparsing)|useprivileged)*) - _wanted values expl 'truth value' compadd yes no && ret=0 + _wanted values expl 'truth value' compadd yes no && ret=0 ;; *(#i)ciphers*) _values -s , 'encryption cipher' \ - '3des-cbc' \ - 'aes128-cbc' \ - 'aes192-cbc' \ - 'aes256-cbc' \ - 'aes128-ctr' \ - 'aes192-ctr' \ - 'aes256-ctr' \ - 'arcfour128' \ - 'arcfour256' \ - 'arcfour' \ - 'blowfish-cbc' \ - 'cast128-cbc' \ - \ - 'rijndael128-cbc' \ - 'rijndael192-cbc' \ - 'rijndael256-cbc' \ - 'rijndael-cbc@lysator.liu.se' \ - && ret=0 + '3des-cbc' \ + 'aes128-cbc' \ + 'aes192-cbc' \ + 'aes256-cbc' \ + 'aes128-ctr' \ + 'aes192-ctr' \ + 'aes256-ctr' \ + 'arcfour128' \ + 'arcfour256' \ + 'arcfour' \ + 'blowfish-cbc' \ + 'cast128-cbc' \ + \ + 'rijndael128-cbc' \ + 'rijndael192-cbc' \ + 'rijndael256-cbc' \ + 'rijndael-cbc@lysator.liu.se' \ + && ret=0 ;; *(#i)cipher*) - _wanted values expl 'encryption cipher (protocol version 1)' \ + _wanted values expl 'encryption cipher (protocol version 1)' \ compadd blowfish 3des des idea arcfour tss none && ret=0 ;; - *(#i)controlmaster*) - _wanted values expl 'truthish value' compadd yes no auto autoask && ret=0 - ;; - *(#i)controlpath*) + *(#i)controlmaster*) + _wanted values expl 'truthish value' compadd yes no auto autoask && ret=0 + ;; + *(#i)controlpath*) _description files expl 'path to control socket' _files "$expl[@]" && ret=0 - ;; + ;; *(#i)globalknownhostsfile*) _description files expl 'global file with known hosts' _files "$expl[@]" && ret=0 ;; *(#i)hostname*) - _wanted hosts expl 'real host name to log into' _ssh_hosts && ret=0 + _wanted hosts expl 'real host name to log into' _ssh_hosts && ret=0 ;; *(#i)identityfile*) _description files expl 'SSH identity file' @@ -236,9 +236,9 @@ _ssh () { ;; *(#i)protocol*) _values -s , 'protocol version' \ - '1' \ - '2' && ret=0 - ;; + '1' \ + '2' && ret=0 + ;; *(#i)proxycommand*) compset -q shift 1 words @@ -253,7 +253,7 @@ _ssh () { _files "$expl[@]" && ret=0 ;; *(#i)user*) - _wanted users expl 'user to log in as' _ssh_users && ret=0 + _wanted users expl 'user to log in as' _ssh_users && ret=0 ;; *(#i)xauthlocation*) _description files expl 'xauth program' @@ -355,7 +355,7 @@ _ssh () { if compset -P '*:'; then _message -e port-numbers 'port number' else - _wanted hosts expl host _ssh_hosts -qS: + _wanted hosts expl host _ssh_hosts -qS: fi else _message -e port-numbers 'listen-port number' @@ -370,18 +370,18 @@ _ssh () { ;; userhost) if compset -P '*@'; then - _wanted hosts expl 'remote host name' _ssh_hosts && ret=0 + _wanted hosts expl 'remote host name' _ssh_hosts && ret=0 elif compset -S '@*'; then _wanted users expl 'login name' _ssh_users -S '' && ret=0 else if (( $+opt_args[-l] )); then - tmp=() - else - tmp=( 'users:login name:_ssh_users -qS@' ) - fi - _alternative \ - 'hosts:remote host name:_ssh_hosts' \ - "$tmp[@]" && ret=0 + tmp=() + else + tmp=( 'users:login name:_ssh_users -qS@' ) + fi + _alternative \ + 'hosts:remote host name:_ssh_hosts' \ + "$tmp[@]" && ret=0 fi ;; file) @@ -393,9 +393,9 @@ _ssh () { _wanted hosts expl 'remote host name' _ssh_hosts $suf && ret=0 else _alternative \ - 'files:: _files' \ - 'hosts:remote host name:_ssh_hosts -r: -S:' \ - 'users:user:_ssh_users -qS@' && ret=0 + 'files:: _files' \ + 'hosts:remote host name:_ssh_hosts -r: -S:' \ + 'users:user:_ssh_users -qS@' && ret=0 fi ;; rfile) @@ -405,8 +405,8 @@ _ssh () { _wanted hosts expl host _ssh_hosts -r: -S: && ret=0 else _alternative \ - 'hosts:remote host name:_ssh_hosts -r: -S:' \ - 'users:user:_ssh_users -qS@' && ret=0 + 'hosts:remote host name:_ssh_hosts -r: -S:' \ + 'users:user:_ssh_users -qS@' && ret=0 fi ;; esac @@ -438,17 +438,17 @@ _ssh_hosts () { local IFS=$'\t ' key hosts host while read key hosts; do if [[ "$key" == (#i)host ]]; then - for host in ${(z)hosts}; do - case $host in - (*[*?]*) ;; - (*) config_hosts+=("$host") ;; - esac - done + for host in ${(z)hosts}; do + case $host in + (*[*?]*) ;; + (*) config_hosts+=("$host") ;; + esac + done fi done < "$config" if (( ${#config_hosts} )); then _wanted hosts expl 'remote host name' \ - compadd -M 'm:{a-zA-Z}={A-Za-z} r:|.=* r:|=*' "$@" $config_hosts + compadd -M 'm:{a-zA-Z}={A-Za-z} r:|.=* r:|=*' "$@" $config_hosts fi fi } -- cgit v1.2.3 From d374f2b1800d54d37a8e4c5299e824874a0489ed Mon Sep 17 00:00:00 2001 From: Simon Ruderich Date: Fri, 9 Dec 2011 22:39:08 +0000 Subject: 29918: Completion: Add new _remote_files() helper and use it to reduce code duplication. --- ChangeLog | 5 ++- Completion/Base/Utility/.distfiles | 2 +- Completion/Base/Utility/_remote_files | 77 +++++++++++++++++++++++++++++++++++ Completion/Unix/Command/_git | 35 +--------------- Completion/Unix/Command/_rlogin | 29 +------------ Completion/Unix/Command/_rsync | 28 +------------ Completion/Unix/Command/_ssh | 38 +---------------- 7 files changed, 87 insertions(+), 127 deletions(-) create mode 100644 Completion/Base/Utility/_remote_files (limited to 'Completion/Unix/Command') diff --git a/ChangeLog b/ChangeLog index 2b4b77b5d..58a820360 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2011-12-09 Simon Ruderich + * 29918: Completion: Add new _remote_files() helper and use it to + reduce code duplication. + * 29917: Completion/Unix/Command/_ssh: Tabs to spaces. 2011-12-09 Mikael Magnusson @@ -15703,5 +15706,5 @@ ***************************************************** * This is used by the shell to define $ZSH_PATCHLEVEL -* $Revision: 1.5528 $ +* $Revision: 1.5529 $ ***************************************************** diff --git a/Completion/Base/Utility/.distfiles b/Completion/Base/Utility/.distfiles index 97d86bdbf..d5e359ae7 100644 --- a/Completion/Base/Utility/.distfiles +++ b/Completion/Base/Utility/.distfiles @@ -5,5 +5,5 @@ _arg_compile _combination _regex_arguments _values _arguments _set_command _retrieve_cache _guard _cache_invalid _describe _sep_parts _pick_variant _call_function _multi_parts _store_cache _regex_words -_complete_help_generic +_complete_help_generic _remote_files ' diff --git a/Completion/Base/Utility/_remote_files b/Completion/Base/Utility/_remote_files new file mode 100644 index 000000000..c35e3d3fa --- /dev/null +++ b/Completion/Base/Utility/_remote_files @@ -0,0 +1,77 @@ +#autoload + +# Complete files on remote systems using SSH (and other programs). Needs +# key-based authentication with no passwords or a running ssh-agent to work. +# +# Usage: +# _remote_files [--no-files] [--no-dirs] -- [] +# +# Options: +# - --no-files: don't complete remote files +# - --no-dirs: don't complete remote directories +# +# Commands: +# - ssh: Additional options for non-interactive use are automatically added +# (see below). +# - All other commands are used unaltered. +# +# Examples: +# - _remote_files -- ssh +# Use ssh to retrieve the remote paths. The "--" is not optional! +# - _remote_files --no-files -- ssh -2 -p 42 +# Use ssh with the option -2 and -p 42 to retrieve the remote paths and +# complete only directories. +# - _remote_files -- rsh +# Use rsh to retrieve the remote paths. + + +# There should be coloring based on all the different ls -F classifiers. +local expl rempat remfiles remdispf remdispd args cmd cmd_args suf ret=1 + +if zstyle -T ":completion:${curcontext}:files" remote-access; then + + # Parse options to _remote_files. Stops at the first "--". + zparseopts -D -E -a args -no-files -no-dirs + shift + + # Command to run on the remote system. + cmd="$1" + shift + + # Handle arguments to ssh. + if [[ $cmd == ssh ]]; then + zparseopts -D -E -a cmd_args p: 1 2 4 6 F: + cmd_args="-o BatchMode=yes $cmd_args -a -x" + else + cmd_args="$@" + fi + + if [[ -z $QIPREFIX ]] + then rempat="${PREFIX%%[^./][^/]#}\*" + else rempat="${(q)PREFIX%%[^./][^/]#}\*" + fi + + remfiles=(${(M)${(f)"$(_call_program files $cmd $cmd_args ${IPREFIX%:} ls -d1FL -- "$rempat" 2>/dev/null)"}%%[^/]#(|/)}) + + compset -P '*/' + compset -S '/*' || suf='remote file' + + remdispf=(${remfiles:#*/}) + remdispd=(${(M)remfiles:#*/}) + + _tags files + while _tags; do + while _next_label files expl ${suf:-remote directory}; do + [[ ${args[(I)--no-files]} -eq 0 ]] && \ + [[ -n $suf ]] && compadd "$@" "$expl[@]" -d remdispf \ + ${(q)remdispf%[*=@|]} && ret=0 + [[ ${args[(I)--no-dirs]} -eq 0 ]] && \ + compadd ${suf:+-S/} "$@" "$expl[@]" -d remdispd \ + ${(q)remdispd%/} && ret=0 + done + (( ret )) || return 0 + done + return ret +else + _message -e remote-files 'remote file' +fi diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index 4a830f281..702afe0e9 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -5444,39 +5444,6 @@ __git_tree_files () { # Repository Argument Types -# _remote_files -_remote_files_git () { - # FIXME: these should be imported from _ssh - # TODO: this should take -/ to only get directories - # There should be coloring based on all the different ls -F classifiers. - local expl rempat remfiles remdispf remdispd args suf ret=1 - - if zstyle -T ":completion:${curcontext}:files" remote-access; then - zparseopts -D -E -a args p: 1 2 4 6 F: - if [[ -z $QIPREFIX ]] - then rempat="${PREFIX%%[^./][^/]#}\*" - else rempat="${(q)PREFIX%%[^./][^/]#}\*" - fi - remfiles=(${(M)${(f)"$(_call_program files ssh $args -a -x ${IPREFIX%:} ls -d1FL "$rempat" 2>/dev/null)"}%%[^/]#(|/)}) - compset -P '*/' - compset -S '/*' || suf='remote file' - - remdispd=(${(M)remfiles:#*/}) - - _tags files - while _tags; do - while _next_label files expl ${suf:-remote directory}; do - compadd ${suf:+-S/} "$@" "$expl[@]" -d remdispd \ - ${(q)remdispd%/} && ret=0 - done - (( ret )) || return 0 - done - return ret - else - _message -e remote-files 'remote file' - fi -} - (( $+functions[__git_remote_repositories] )) || __git_remote_repositories () { local service @@ -5484,7 +5451,7 @@ __git_remote_repositories () { service= _ssh if compset -P '*:'; then - _remote_files_git + _remote_files --no-files -- ssh else _ssh_hosts -S: fi diff --git a/Completion/Unix/Command/_rlogin b/Completion/Unix/Command/_rlogin index 0d8355bfb..a04c6d068 100644 --- a/Completion/Unix/Command/_rlogin +++ b/Completion/Unix/Command/_rlogin @@ -1,32 +1,5 @@ #compdef rlogin rsh remsh=rsh rcp -_rcp_remote_files () { - # There should be coloring based on all the different ls -F classifiers. - local expl remfiles remdispf remdispd suf ret=1 - - if zstyle -T ":completion:${curcontext}:" remote-access; then - remfiles=(${(M)${(f)"$(rsh ${IPREFIX%:} ls -d1F ${(Q)PREFIX%%[^./][^/]#}\* 2>/dev/null)"}%%[^/]#(|/)}) - compset -P '*/' - compset -S '/*' || suf='remote file' - - remdispf=(${remfiles:#*/}) - remdispd=(${(M)remfiles:#*/}) - - _tags files - while _tags; do - while _next_label files expl ${suf:-remote directory}; do - [[ -n $suf ]] && compadd "$@" "$expl[@]" -d remdispf \ - ${(q)remdispf%[*=@|]} && ret=0 - compadd ${suf:+-S/} "$@" "$expl[@]" -d remdispd \ - ${(q)remdispd%/} && ret=0 - done - (( ret )) || return 0 - done - else - _message -e remote-files 'remote file' - fi -} - _rlogin () { case "$service" in rlogin) @@ -65,7 +38,7 @@ _rlogin () { if [[ -n "$state" ]]; then if compset -P '*:'; then - _rcp_remote_files && ret=0 + _remote_files -- rsh && ret=0 elif compset -P '*@'; then _wanted hosts expl host _rlogin_hosts -S: && ret=0 else diff --git a/Completion/Unix/Command/_rsync b/Completion/Unix/Command/_rsync index b999c1bbd..f24a06e47 100644 --- a/Completion/Unix/Command/_rsync +++ b/Completion/Unix/Command/_rsync @@ -59,33 +59,7 @@ elif compset -P 1 '*::' || compset -P 1 'rsync://*/'; then elif compset -P 'rsync://'; then _rsync_user_or_host / "$@" elif compset -P 1 '*:'; then - - if zstyle -T ":completion:${curcontext}:files" remote-access; then - if [[ -z $QIPREFIX ]] - then rempat="${PREFIX%%[^./][^/]#}\*" - else rempat="${(q)PREFIX%%[^./][^/]#}\*" - fi - remfiles=(${(M)${(f)"$(_call_program files ssh -a -x ${IPREFIX%:} ls -d1FL "$rempat" 2>/dev/null)"}%%[^/]#(|/)}) - compset -P '*/' - compset -S '/*' || suf='remote file' - - remdispf=(${remfiles:#*/}) - remdispd=(${(M)remfiles:#*/}) - - _tags files - while _tags; do - while _next_label files expl ${suf:-remote directory}; do - [[ -n $suf ]] && compadd "$@" "$expl[@]" -d remdispf \ - ${(q)remdispf%[*=@|]} && ret=0 - compadd ${suf:+-S/} "$@" "$expl[@]" -d remdispd \ - ${(q)remdispd%/} && ret=0 - done - (( ret )) || return 0 - done - else - _message -e remote-files 'remote file' - fi - + _remote_files -- ssh else _rsync_user_or_host : "$@" fi diff --git a/Completion/Unix/Command/_ssh b/Completion/Unix/Command/_ssh index bd23c3627..a6f2b40a2 100644 --- a/Completion/Unix/Command/_ssh +++ b/Completion/Unix/Command/_ssh @@ -5,40 +5,6 @@ # TODO: update ssh-keygen (not based on 5.9) # TODO: sshd, ssh-keyscan, ssh-keysign - -_remote_files () { - # There should be coloring based on all the different ls -F classifiers. - local expl rempat remfiles remdispf remdispd args suf ret=1 - - if zstyle -T ":completion:${curcontext}:files" remote-access; then - zparseopts -D -E -a args p: 1 2 4 6 F: - if [[ -z $QIPREFIX ]] - then rempat="${PREFIX%%[^./][^/]#}\*" - else rempat="${(q)PREFIX%%[^./][^/]#}\*" - fi - remfiles=(${(M)${(f)"$(_call_program files ssh -o BatchMode=yes $args -a -x ${IPREFIX%:} ls -d1FL -- "$rempat" 2>/dev/null)"}%%[^/]#(|/)}) - compset -P '*/' - compset -S '/*' || suf='remote file' - - remdispf=(${remfiles:#*/}) - remdispd=(${(M)remfiles:#*/}) - - _tags files - while _tags; do - while _next_label files expl ${suf:-remote directory}; do - [[ -n $suf ]] && compadd "$@" "$expl[@]" -d remdispf \ - ${(q)remdispf%[*=@|]} && ret=0 - compadd ${suf:+-S/} "$@" "$expl[@]" -d remdispd \ - ${(q)remdispd%/} && ret=0 - done - (( ret )) || return 0 - done - return ret - else - _message -e remote-files 'remote file' - fi -} - _ssh () { local curcontext="$curcontext" state line expl common tmp cmds suf ret=1 typeset -A opt_args @@ -386,7 +352,7 @@ _ssh () { ;; file) if compset -P '*:'; then - _remote_files ${(kv)~opt_args[(I)-[FP1246]]/-P/-p} && ret=0 + _remote_files -- ssh ${(kv)~opt_args[(I)-[FP1246]]/-P/-p} && ret=0 elif compset -P '*@'; then suf=( -S '' ) compset -S ':*' || suf=( -r: -S: ) @@ -400,7 +366,7 @@ _ssh () { ;; rfile) if compset -P '*:'; then - _remote_files && ret=0 + _remote_files -- ssh && ret=0 elif compset -P '*@'; then _wanted hosts expl host _ssh_hosts -r: -S: && ret=0 else -- cgit v1.2.3 From ac78bd010ccc8793dd2198d58cdf3f8e560fb00c Mon Sep 17 00:00:00 2001 From: Mikael Magnusson Date: Sat, 10 Dec 2011 19:35:49 +0000 Subject: 29962: Actually return ret in _ssh. --- ChangeLog | 6 +++++- Completion/Unix/Command/_ssh | 2 ++ 2 files changed, 7 insertions(+), 1 deletion(-) (limited to 'Completion/Unix/Command') diff --git a/ChangeLog b/ChangeLog index 6b1da0842..fe69dca30 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2011-12-10 Mikael Magnusson + + * 29962: Completion/Unix/Command/_ssh: Actually return ret. + 2011-12-10 Peter Stephenson * GI: 29977: Completion/Linux/Command/_modutils: caching and @@ -15711,5 +15715,5 @@ ***************************************************** * This is used by the shell to define $ZSH_PATCHLEVEL -* $Revision: 1.5532 $ +* $Revision: 1.5533 $ ***************************************************** diff --git a/Completion/Unix/Command/_ssh b/Completion/Unix/Command/_ssh index a6f2b40a2..dc4b65d31 100644 --- a/Completion/Unix/Command/_ssh +++ b/Completion/Unix/Command/_ssh @@ -377,6 +377,8 @@ _ssh () { ;; esac done + + return ret } _ssh_users () { -- cgit v1.2.3 From a7794bd1532c2fc6ff984f9b743c08e9ac90a923 Mon Sep 17 00:00:00 2001 From: Mikael Magnusson Date: Sat, 10 Dec 2011 19:37:35 +0000 Subject: 29961: _ssh: extend option completion. --- ChangeLog | 4 +- Completion/Unix/Command/_ssh | 239 ++++++++++++++++++++++++++++++++++++------- 2 files changed, 204 insertions(+), 39 deletions(-) (limited to 'Completion/Unix/Command') diff --git a/ChangeLog b/ChangeLog index fe69dca30..616d1d41f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,8 @@ * 29962: Completion/Unix/Command/_ssh: Actually return ret. + * 29961: Completion/Unix/Command/_ssh: Extend option completion. + 2011-12-10 Peter Stephenson * GI: 29977: Completion/Linux/Command/_modutils: caching and @@ -15715,5 +15717,5 @@ ***************************************************** * This is used by the shell to define $ZSH_PATCHLEVEL -* $Revision: 1.5533 $ +* $Revision: 1.5534 $ ***************************************************** diff --git a/Completion/Unix/Command/_ssh b/Completion/Unix/Command/_ssh index dc4b65d31..8f1fb74aa 100644 --- a/Completion/Unix/Command/_ssh +++ b/Completion/Unix/Command/_ssh @@ -15,6 +15,7 @@ _ssh () { '(-6)-4[forces ssh to use IPv4 addresses only]' '(-4)-6[forces ssh to use IPv6 addresses only]' '-C[compress data]' + # for protocol version 2, this can be a comma-separated list '-c+[select encryption cipher]:encryption cipher:(idea des 3des blowfish arcfour tss none)' '-F+[specify alternate config file]:config file:_files' '-i+[select identity file]:SSH identity file:_files' @@ -36,25 +37,20 @@ _ssh () { '(-a)-A[enables forwarding of the authentication agent connection]' \ '(-A)-a[disable forwarding of authentication agent connection]' \ '(-P)-b+[specify interface to transmit on]:bind address:_bind_addresses' \ - '-D+[specify a dynamic port forwarding]:[bind-address]\:port' \ - '-e+[set escape character]:escape character (or `none'"'"'):' \ + '-D+[specify a dynamic port forwarding]:dynamic port forwarding:->dynforward' \ + '-e+[set escape character]:escape character (or `none'\''):' \ '(-n)-f[go to background]' \ '-g[allow remote hosts to connect to local forwarded ports]' \ - '-I+[specify the PKCS#11 shared library to use]' \ + '-I+[specify smartcard device]:device:_files' \ '-K[enable GSSAPI-based authentication and forwarding]' \ '-k[disable forwarding of GSSAPI credentials]' \ '*-L[specify local port forwarding]:local port forwarding:->forward' \ '-l+[specify login name]:login name:_ssh_users' \ '-M[master mode for connection sharing]' \ - '(-1)-m+[specify mac algorithms]:mac spec' \ + '(-1)-m+[specify mac algorithms]:mac spec:->macs' \ '(-1)-N[do not execute a remote command (protocol version 2 only)]' \ '-n[redirect stdin from /dev/null]' \ - '-O[control active connection multiplexing master process]:multiplex control command:(( - check\:"check that the master process is running" - forward\:"request forwardings without command execution" - cancel\:"cancel forwardings" - exit\:"request the master to exit" - stop\:"request the master to stop accepting further multiplexing requests"))' \ + '-O:multiplex control command:((check\:"check master process is running" exit\:"request the master to exit" forward\:"request forward without command execution" stop\:"request the master to stop accepting further multiplexing requests"))' \ '-P[use non privileged port]' \ '-p+[specify port on remote host]:port number on remote host' \ '(-v)*-q[quiet operation]' \ @@ -65,19 +61,19 @@ _ssh () { '(-T)-t[force pseudo-tty allocation]' \ '-V[show version number]' \ '(-q)*-v[verbose mode]' \ - '(-N)-W[forward standard input/output over host:port (protocol version 2 only)]:host\:port' \ - '-w[request tunnel device forwarding with the specified tun devices]:local_tun[\:remote_tun]' \ + '-W[forward standard input and output to host]:stdinout forward:->hostport' \ + '-w[request tunnel device forwarding]:local_tun[\:remote_tun] (integer or "any"):' \ '(-x -Y)-X[enable (untrusted) X11 forwarding]' \ '(-X -Y)-x[disable X11 forwarding]' \ '(-x -X)-Y[enable trusted X11 forwarding]' \ - '-y[send log information using the syslog module]' \ + '-y[send log info via syslog instead of stderr]' \ ':remote host name:->userhost' \ '*::args:->command' "$common[@]" && ret=0 ;; scp) _arguments -C -s \ '-3[copy through local host, not directly between the remote hosts]' \ - '-B[batch mode (don'"'"'t ask for passphrases)]' \ + '-B[batch mode (don'\''t ask for passphrases)]' \ '*:file:->file' "$common[@]" "$common_transfer[@]" && ret=0 ;; ssh-add) @@ -112,7 +108,7 @@ _ssh () { _arguments \ '-q[silence ssh-keygen]' \ "($cmds -P)-b[specify number of bits in key]:bits in key" \ - "($cmds -P)-t[specify the type of the key to create]:key type:(rsa1 rsa dsa)" \ + "($cmds -P)-t[specify the type of the key to create]:key type:(rsa1 rsa dsa ecdsa)" \ "(${cmds#-p })-N[provide new passphrase]:new passphrase" \ "($cmds -b -t)-C[provide new comment]:new comment" \ '(-D)-f[key file]:key file:_files' \ @@ -145,12 +141,18 @@ _ssh () { case "$lstate" in option) - if compset -P '*[= ]'; then + if compset -P '*='; then case "$IPREFIX" in - *(#i)(afstokenpassing|batchmode|compression|fallbacktorsh|forward(agent|x11)|keepalive|passwordauthentication|rhosts(|rsa)authentication|rsaauthentication|usersh|kerberos(authetication|tgtparsing)|useprivileged)*) + *(#i)(afstokenpassing|batchmode|challengeresponseauthentication|checkhostip|clearallforwardings|compression|enablesshkeysign|exitonforwardfailure|fallbacktorsh|forward(agent|x11)|forwardx11trusted|gatewayports|gssapiauthentication|gssapidelegatecredentials|gssapitrustdns|hashknownhosts|hostbasedauthentication|identitiesonly|kbdinteractiveauthentication|(tcp|)keepalive|nohostauthenticationforlocalhost|passwordauthentication|permitlocalcommand|pubkeyauthentication|rhosts(|rsa)authentication|rsaauthentication|usersh|kerberos(authentication|tgtpassing)|useprivilegedport|visualhostkey)=*) _wanted values expl 'truth value' compadd yes no && ret=0 ;; - *(#i)ciphers*) + *(#i)addressfamily=*) + _wanted values expl 'address family' compadd any inet inet6 && ret=0 + ;; + *(#i)bindaddress=*) + _wanted bind-addresses expl 'bind address' _bind_addresses && ret=0 + ;; + *(#i)ciphers=*) _values -s , 'encryption cipher' \ '3des-cbc' \ 'aes128-cbc' \ @@ -171,57 +173,177 @@ _ssh () { 'rijndael-cbc@lysator.liu.se' \ && ret=0 ;; - *(#i)cipher*) + *(#i)cipher=*) _wanted values expl 'encryption cipher (protocol version 1)' \ compadd blowfish 3des des idea arcfour tss none && ret=0 ;; - *(#i)controlmaster*) + *(#i)compressionlevel=*) + _values 'compression level' {1..9} && ret=0 + ;; + *(#i)connectionattempts=*) + _message -e 'connection attempts' && ret=0 + ;; + *(#i)connecttimeout=*) + _message -e 'connection timeout' && ret=0 + ;; + *(#i)controlmaster=*) _wanted values expl 'truthish value' compadd yes no auto autoask && ret=0 ;; - *(#i)controlpath*) + *(#i)controlpath=*) _description files expl 'path to control socket' _files "$expl[@]" && ret=0 ;; - *(#i)globalknownhostsfile*) + *(#i)controlpersist=*) + _message -e 'timeout' + ret=0 + _wanted values expl 'truth value' compadd yes no && ret=0 + ;; + *(#i)escapechar=*) + _message -e 'escape character (or `none'\'')' + ret=0 + ;; + *(#i)forwardx11timeout=*) + _message -e 'timeout' + ret=0 + ;; + *(#i)globalknownhostsfile=*) _description files expl 'global file with known hosts' _files "$expl[@]" && ret=0 ;; - *(#i)hostname*) + *(#i)hostname=*) _wanted hosts expl 'real host name to log into' _ssh_hosts && ret=0 ;; - *(#i)identityfile*) + *(#i)hostkeyalgorithms=*) + _values -s , 'host key algorithms' \ + 'ecdsa-sha2-nistp256-cert-v01@openssh.com' \ + 'ecdsa-sha2-nistp384-cert-v01@openssh.com' \ + 'ecdsa-sha2-nistp521-cert-v01@openssh.com' \ + 'ssh-rsa-cert-v01@openssh.com' \ + 'ssh-dss-cert-v01@openssh.com' \ + 'ssh-rsa-cert-v00@openssh.com' \ + 'ssh-dss-cert-v00@openssh.com' \ + 'ecdsa-sha2-nistp256' \ + 'ecdsa-sha2-nistp384' \ + 'ecdsa-sha2-nistp521' \ + 'ssh-rsa' \ + 'ssh-dss' && ret=0 + ;; + *(#i)identityfile=*) _description files expl 'SSH identity file' _files "$expl[@]" && ret=0 ;; - *(#i)(local|remote)forward*) + *(#i)ipqos=*) + local descr + if [[ $PREFIX = *\ *\ * ]]; then return 1; fi + if compset -P '* '; then + descr='QoS for non-interactive sessions' + else + descr='QoS [for interactive sessions if second value given, separated by white space]' + fi + _values $descr 'af11' 'af12' 'af13' 'af14' 'af22' \ + 'af23' 'af31' 'af32' 'af33' 'af41' 'af42' 'af43' \ + 'cs0' 'cs1' 'cs2' 'cs3' 'cs4' 'cs5' 'cs6' 'cs7' 'ef' \ + 'lowdelay' 'throughput' 'reliability' && ret=0 + ;; + *(#i)(local|remote)forward=*) state=forward ;; - *(#i)preferredauthentications*) + *(#i)dynamicforward=*) + state=dynforward + ;; + *(#i)kbdinteractivedevices=*) + _values -s , 'keyboard-interactive authentication methods' \ + 'bsdauth' 'pam' 'skey' && ret=0 + ;; + *(#i)kexalgorithms=*) + _values -s , 'KEX algorithms' \ + ecdh-sha2-nistp256 ecdh-sha2-nistp384 ecdh-sha2-nistp521 \ + diffie-hellman-group-exchange-sha256 \ + diffie-hellman-group-exchange-sha1 \ + diffie-hellman-group14-sha1 diffie-hellman-group1-sha1 && ret=0 + ;; + *(#i)localcommand=*) + _description commands expl 'run command locally after connecting' + _command_names && ret=0 + ;; + *(#i)loglevel=*) + _values 'log level' QUIET FATAL ERROR INFO VERBOSE\ + DEBUG DEBUG1 DEBUG2 DEBUG3 && ret=0 + ;; + *(#i)macs=*) + state=macs + ;; + *(#i)numberofpasswordprompts=*) + _message -e 'number of password prompts' + ret=0 + ;; + *(#i)pkcs11provider=*) + _description files expl 'PKCS#11 shared library' + _files -g '*.so' "$expl[@]" && ret=0 + ;; + *(#i)port=*) + _message -e 'port number on remote host' + ret=0 + ;; + *(#i)preferredauthentications=*) _values -s , 'authentication method' gssapi-with-mic \ hostbased publickey keyboard-interactive password && ret=0 ;; - *(#i)protocol*) + *(#i)protocol=*) _values -s , 'protocol version' \ '1' \ '2' && ret=0 ;; - *(#i)proxycommand*) + *(#i)proxycommand=*) compset -q shift 1 words (( CURRENT-- )) _normal && ret=0 ;; - *(#i)stricthostkeychecking*) + *(#i)rekeylimit=*) + _message -e 'maximum number of bytes transmitted before renegotiating session key' + ret=0 + ;; + *(#i)requesttty=*) + _values 'request a pseudo-tty' \ + 'no[never request a TTY]' \ + 'yes[always request a TTY when stdin is a TTY]' \ + 'force[always request a TTY]' \ + 'auto[request a TTY when opening a login session]' && ret=0 + ;; + *(#i)sendenv=*) + _wanted envs expl 'environment variable' _parameters -g 'scalar*export*' && ret=0 + ;; + *(#i)serveralivecountmax=*) + _message -e 'number of alive messages without replies before disconnecting' + ret=0 + ;; + *(#i)serveraliveinterval=*) + _message -e 'timeout in seconds since last data was received to send alive message' + ret=0 + ;; + *(#i)(stricthostkeychecking|verifyhostkeydns)=*) _wanted values expl 'checking type' compadd yes no ask && ret=0 ;; - *(#i)userknownhostsfile*) + *(#i)tunnel=*) + _values 'request device forwarding' \ + 'yes' \ + 'point-to-point' \ + 'ethernet' \ + 'no' && ret=0 + ;; + *(#i)tunneldevice=*) + _message -e 'local_tun[:remote_tun] (integer or "any")' + ret=0 + ;; + *(#i)userknownhostsfile=*) _description files expl 'user file with known hosts' _files "$expl[@]" && ret=0 ;; - *(#i)user*) + *(#i)user=*) _wanted users expl 'user to log in as' _ssh_users && ret=0 ;; - *(#i)xauthlocation*) + *(#i)xauthlocation=*) _description files expl 'xauth program' _files "$expl[@]" -g '*(-*)' && ret=0 ;; @@ -229,7 +351,7 @@ _ssh () { else # old options are after the empty "\"-line _wanted values expl 'configure file option' \ - compadd -M 'm:{a-z}={A-Z}' -qS '=' - \ + compadd -M 'm:{a-z}={A-Z}' -S '=' - \ AddressFamily \ BatchMode \ BindAddress \ @@ -257,6 +379,7 @@ _ssh () { GlobalKnownHostsFile \ GSSAPIAuthentication \ GSSAPIDelegateCredentials \ + GSSAPITrustDns \ HashKnownHosts \ Host \ HostbasedAuthentication \ @@ -317,16 +440,56 @@ _ssh () { fi ;; forward) + local port=false host=false listen=false bind=false if compset -P 1 '*:'; then - if compset -P '*:'; then - _message -e port-numbers 'port number' + if [[ $IPREFIX != (*=|)<-65535>: ]]; then + if compset -P 1 '*:'; then + if compset -P '*:'; then + port=true + else + host=true + fi + else + listen=true + ret=0 + fi else - _wanted hosts expl host _ssh_hosts -qS: + if compset -P '*:'; then + port=true + else + host=true + fi fi else - _message -e port-numbers 'listen-port number' + listen=true + bind=true fi - return + $port && { _message -e port-numbers 'port number'; ret=0 } + $listen && { _message -e port-numbers 'listen-port number'; ret=0 } + $host && { _wanted hosts expl host _ssh_hosts -S: && ret=0 } + $bind && { _wanted bind-addresses expl bind-address _bind_addresses -S: && ret=0 } + return ret + ;; + dynforward) + _message -e port-numbers 'listen-port number' + if ! compset -P '*:'; then + _wanted bind-addresses expl bind-address _bind_addresses -qS: + fi + return 0 + ;; + hostport) + if compset -P '*:'; then + _message -e port-numbers 'port number' + ret=0 + else + _wanted hosts expl host _ssh_hosts -S: && ret=0 + fi + return ret + ;; + macs) + _values -s , 'MAC algorithms' hmac-md5 hmac-sha1 umac-64@openssh.com \ + hmac-ripemd160 hmac-sha1-96 hmac-md5-96 hmac-sha2-256 \ + hmac-sha2-256-96 hmac-sha2-512 hmac-sha2-512-96 && ret=0 ;; command) shift 1 words -- cgit v1.2.3 From 02dc5c681e1661b00761a6a98df9a85cfa82bae0 Mon Sep 17 00:00:00 2001 From: Mikael Magnusson Date: Tue, 13 Dec 2011 19:28:19 +0000 Subject: 29998: _git: fix a typo (--rerbose). --- ChangeLog | 6 +++++- Completion/Unix/Command/_git | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) (limited to 'Completion/Unix/Command') diff --git a/ChangeLog b/ChangeLog index 808531c23..d3403a23b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2011-12-13 Mikael Magnusson + + * 29998: Completion/Unix/Command/_git: fix a typo (--rerbose). + 2011-12-13 Barton E. Schaefer * 30020: Functions/Prompts/promptinit: prevent prompt_opts and @@ -15746,5 +15750,5 @@ ***************************************************** * This is used by the shell to define $ZSH_PATCHLEVEL -* $Revision: 1.5538 $ +* $Revision: 1.5539 $ ***************************************************** diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index 702afe0e9..8a48c04b7 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -2619,7 +2619,7 @@ _git-pack-refs () { _git-prune () { _arguments -S \ '(-n --dry-run)'{-n,--dry-run}'[do not remove anything; just report what would be removed]' \ - '(-v --verbose)'{-v,--rerbose}'[report all removed objects]' \ + '(-v --verbose)'{-v,--verbose}'[report all removed objects]' \ '--expire[only expire loose objects older than given date]: :__git_datetimes' \ '*:: :__git_heads' } -- cgit v1.2.3 From fd1c2364f42993c327f10b8a1b3ce205de06e501 Mon Sep 17 00:00:00 2001 From: Mikael Magnusson Date: Tue, 13 Dec 2011 19:33:15 +0000 Subject: 30019: _tar: fix parsing of argument to -C. --- ChangeLog | 5 ++++- Completion/Unix/Command/_tar | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) (limited to 'Completion/Unix/Command') diff --git a/ChangeLog b/ChangeLog index d3403a23b..d434032fe 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,9 @@ * 29998: Completion/Unix/Command/_git: fix a typo (--rerbose). + * 30019: Completion/Unix/Command/_tar: fix parsing of argument + to -C. + 2011-12-13 Barton E. Schaefer * 30020: Functions/Prompts/promptinit: prevent prompt_opts and @@ -15750,5 +15753,5 @@ ***************************************************** * This is used by the shell to define $ZSH_PATCHLEVEL -* $Revision: 1.5539 $ +* $Revision: 1.5540 $ ***************************************************** diff --git a/Completion/Unix/Command/_tar b/Completion/Unix/Command/_tar index 4f3247291..ce5852453 100644 --- a/Completion/Unix/Command/_tar +++ b/Completion/Unix/Command/_tar @@ -177,7 +177,7 @@ else fi fi if (( index )); then - index="$~words[index+1]" + index=${~${(Q)words[index+1]}} [[ $index = (.|..|)/* ]] || index=~+/$index _files -W $index else -- cgit v1.2.3 From 0082320b79b49a12a497e730bb18807cc2d69bbd Mon Sep 17 00:00:00 2001 From: Peter Stephenson Date: Fri, 16 Dec 2011 09:18:34 +0000 Subject: Simon Olofsson: fix matching of subversion help text --- ChangeLog | 7 ++++++- Completion/Unix/Command/_subversion | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) (limited to 'Completion/Unix/Command') diff --git a/ChangeLog b/ChangeLog index e3424de67..1b7e9e33b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2011-12-16 Peter Stephenson + + * Simon Olofsson: 30028: Completion/Unix/Command/_subversion: + fix matching of subversion help text. + 2011-12-14 Mikael Magnusson * 30021: Completion/Zsh/Type/_globquals: Add d flag (see 29991), @@ -15762,5 +15767,5 @@ ***************************************************** * This is used by the shell to define $ZSH_PATCHLEVEL -* $Revision: 1.5542 $ +* $Revision: 1.5543 $ ***************************************************** diff --git a/Completion/Unix/Command/_subversion b/Completion/Unix/Command/_subversion index 88142d805..21d809dd1 100644 --- a/Completion/Unix/Command/_subversion +++ b/Completion/Unix/Command/_subversion @@ -48,7 +48,7 @@ _svn () { ! _retrieve_cache svn-${cmd}-args; then args=( - ${=${${${(M)${(f)"$(LC_ALL=C _call_program options svn help $cmd)"#(*Valid options:|(#e))}:#* :*}%% #:*}/ (arg|ARG)/:arg:}/(#b)-([[:alpha:]]) \[--([a-z-]##)\](:arg:)#/(--$match[2])-$match[1]$match[3] (-$match[1])--$match[2]$match[3]} + ${=${${${(M)${(f)"$(LC_ALL=C _call_program options svn help $cmd)"#(*Valid options:|(#e))}:#* :*}%% #:*}/ (arg|ARG)/:arg:}/(#b)(-##)([[:alpha:]]##) \[--([a-z-]##)\](:arg:)#/(--$match[3])$match[1]$match[2]$match[4] ($match[1]$match[2])--$match[3]$match[4]} ) _store_cache svn-${cmd}-args args fi -- cgit v1.2.3