diff options
author | Tanaka Akira <akr@users.sourceforge.net> | 1999-11-22 12:29:47 +0000 |
---|---|---|
committer | Tanaka Akira <akr@users.sourceforge.net> | 1999-11-22 12:29:47 +0000 |
commit | 3d9d13e918c195f974ff7b2f1dc5b65f6b20a441 (patch) | |
tree | d571aef9c8152287ed94dae1199108de80f0b984 /Completion/Base | |
parent | a76b36928c5cbeef3fe015ca30bbf910ab2a107e (diff) | |
download | zsh-3d9d13e918c195f974ff7b2f1dc5b65f6b20a441.tar.gz zsh-3d9d13e918c195f974ff7b2f1dc5b65f6b20a441.tar.xz zsh-3d9d13e918c195f974ff7b2f1dc5b65f6b20a441.zip |
zsh-workers/8720
Diffstat (limited to 'Completion/Base')
-rw-r--r-- | Completion/Base/_combination | 40 | ||||
-rw-r--r-- | Completion/Base/_describe | 2 | ||||
-rw-r--r-- | Completion/Base/_jobs | 2 | ||||
-rw-r--r-- | Completion/Base/_subscript | 2 | ||||
-rw-r--r-- | Completion/Base/_tilde | 2 |
5 files changed, 22 insertions, 26 deletions
diff --git a/Completion/Base/_combination b/Completion/Base/_combination index 69ae973f9..97da22a5f 100644 --- a/Completion/Base/_combination +++ b/Completion/Base/_combination @@ -1,24 +1,26 @@ #autoload # Usage: -# _combination [-s S] V[:K1:...] Ki1[:Ni1]=Pi1 Ki2[:Ni2]=Pi2 ... Kim[:Nim]=Pim Kj[:Nj] EXPL... +# _combination [-s S] TAG STYLE \ +# Ki1[:Ni1]=Pi1 Ki2[:Ni2]=Pi2 ... Kim[:Nim]=Pim Kj[:Nj] EXPL... # -# It is assumed that V is formed as PRE_K1_..._Kn if `:K1:...' is not specified. +# STYLE should be of the form K1-K2-...-Kn. # # Example: telnet # -# Assume an user sets the variable `telnet_hosts_ports_users' as: +# Assume an user sets the style `hosts-ports-users' as for the my-accounts +# tag: # -# telnet_hosts_ports_users=( +# compstyle '*:telnet*:my-accounts' hosts-ports-users \ # host0:: host1::user1 host2::user2 # mail-server:{smtp,pop3}: # news-server:nntp: # proxy-server:8000: -# ) +# # -# `_telnet completes' hosts as: +# `_telnet' completes hosts as: # -# _combination telnet_hosts_ports_users \ +# _combination my-accounts hosts-ports-users \ # ${options[-l]:+users=${options[-l]:q}} \ # hosts "$expl[@]" # @@ -28,7 +30,7 @@ # # `_telnet' completes ports as: # -# _combination telnet_hosts_ports_users \ +# _combination my-accounts hosts-ports-users \ # ${options[-l]:+users=${options[-l]:q}} \ # hosts="${line[2]:q}" \ # ports "$expl[@]" @@ -39,7 +41,7 @@ # # `_telnet' completes users for an argument of option `-l' as: # -# _combination telnet_hosts_ports_users \ +# _combination my-accounts hosts-ports-users \ # ${line[2]:+hosts="${line[2]:q}"} \ # ${line[3]:+ports="${line[3]:q}"} \ # users "$expl[@]" @@ -48,7 +50,7 @@ # the port argument if they are exist. And if it is failed, `_users' is # called. -local sep var keys pats key num tmp +local sep tag style keys pats key num tmp if [[ "$1" = -s ]]; then sep="$2" @@ -57,16 +59,11 @@ else sep=: fi -var=$1 -shift +tag="$1" +style="$2" +shift 2 -if [[ $var = *:* ]]; then - keys=( ${(s/:/)var} ) - shift keys - var="${var%%:*}" -else - keys=( "${(@s:_:)${var#*_}}" ) -fi +keys=( ${(s/-/)style} ) pats=( "${(@)keys/*/*}" ) while [[ "$1" = *=* ]]; do @@ -81,8 +78,8 @@ key="${1%:*}" num="${${1##*:}:-1}" shift -if (( ${(P)+${var}} )); then - eval "tmp=( \"\${(@M)${var}:#\${(j($sep))~pats}}\" )" +if _style -a "$tag" "$style" tmp; then + eval "tmp=( \"\${(@M)tmp:#\${(j($sep))~pats}}\" )" if (( keys[(in:num:)$key] != 1 )); then eval "tmp=( \${tmp#\${(j(${sep}))~\${(@)\${(@)keys[2,(rn:num:)\$key]}/*/*}}$sep} )" fi @@ -92,4 +89,3 @@ if (( ${(P)+${var}} )); then else (( $+functions[_$key] )) && "_$key" "$@" fi - diff --git a/Completion/Base/_describe b/Completion/Base/_describe index f1fbbafc6..3d0d8507c 100644 --- a/Completion/Base/_describe +++ b/Completion/Base/_describe @@ -16,7 +16,7 @@ fi _tags "$_type" || return 1 -_style "$_type" description && _showd=yes +_style "$_type" verbose && _showd=yes _description _expl "$1" shift diff --git a/Completion/Base/_jobs b/Completion/Base/_jobs index d9297086b..2a1b725b4 100644 --- a/Completion/Base/_jobs +++ b/Completion/Base/_jobs @@ -6,7 +6,7 @@ _tags jobs || return 1 _style jobs prefix-needed && [[ "$PREFIX" != %* ]] && return 1 _style jobs prefix-hidden && pfx='' -_style jobs description && desc=yes +_style jobs verbose && desc=yes if [[ "$1" = -r ]]; then jids=( "${(@k)jobstates[(R)running*]}" ) diff --git a/Completion/Base/_subscript b/Completion/Base/_subscript index a3b97a45e..cc3e9c435 100644 --- a/Completion/Base/_subscript +++ b/Completion/Base/_subscript @@ -21,7 +21,7 @@ elif [[ ${(Pt)${compstate[parameter]}} = array* ]]; then while _tags; do if _requested indexes -V expl 'array index'; then ind=( {1..${#${(P)${compstate[parameter]}}}} ) - if _style indexes description; then + if _style indexes verbose; then list=() for i in "$ind[@]"; do [[ "$i" = ${PREFIX}*${SUFFIX} ]] && diff --git a/Completion/Base/_tilde b/Completion/Base/_tilde index bd21cd044..d9eb0a887 100644 --- a/Completion/Base/_tilde +++ b/Completion/Base/_tilde @@ -24,7 +24,7 @@ while _tags; do if _requested directory-stack -V expl 'directory stack' && { ! _style directory-stack prefix-needed || [[ "$PREFIX" = [-+]* ]] }; then - if _style directory-stack description; then + if _style directory-stack verbose; then integer i lines=("${PWD}" "${dirstack[@]}") |