From 54c500a3f8779dee553c4a46a753c0cd1baef09d Mon Sep 17 00:00:00 2001 From: Tanaka Akira Date: Tue, 2 Nov 1999 12:26:43 +0000 Subject: zsh-workers/8484 --- Completion/User/_whois | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) (limited to 'Completion/User/_whois') diff --git a/Completion/User/_whois b/Completion/User/_whois index 580529a72..f64d3930e 100644 --- a/Completion/User/_whois +++ b/Completion/User/_whois @@ -5,7 +5,7 @@ _whois () { $_whois_comp } -builtin functions _whois_setup >&- || +(( $+functions[_whois_setup] )) || _whois_setup () { (( $+_whois_defaultserver )) || _whois_defaultserver='whois.internic.net' @@ -64,6 +64,7 @@ _whois_setup () { (( $+_whois_arguments )) || { local help="$(whois &1)" local tmp opt opts + local hostopt=-h+ if [[ $help = *"user[@]"* ]]; then _whois_comp=_whois_fwhois @@ -71,6 +72,7 @@ _whois_setup () { _whois_comp=_whois_multi else _whois_comp=_whois_single + hostopt=-h fi _whois_arguments=() @@ -95,9 +97,13 @@ _whois_setup () { for opt in $tmp; do opts=(-${^tmp:#$opt}) if (( $#opts )); then opts="($opts)"; else opts=; fi - _whois_arguments=("$_whois_arguments[@]" - "${opts}-${opt}[${${${(@M)_whois_servers:#*:$opt}%:?}:-specify host}]${(M)${(M)opt:#h}/h/:host:_whois_hosts}" - ) + if [[ $opt = h ]]; then + _whois_arguments=("$_whois_arguments[@]" + "${opts}${hostopt}[specify host]:host:_whois_hosts") + else + _whois_arguments=("$_whois_arguments[@]" + "${opts}-${opt}[${${(@M)_whois_servers:#*:$opt}%:?}]") + fi done } } @@ -113,7 +119,7 @@ _whois_single () { case "$state" in identifier) - if [[ -z "$QIPREFIX" ]]; then + if [[ -z "$QIPREFIX" && -z "$PREFIX" ]]; then compadd -QS '' \' return fi @@ -125,7 +131,7 @@ _whois_single () { break fi done - if builtin functions "_whois:$host" >&-; then + if (( $+functions[_whois:$host] )); then "_whois:$host" "$expl[@]" else _message "identifier" @@ -152,7 +158,7 @@ _whois_multi () { break fi done - if builtin functions "_whois:$host" >&-; then + if (( $+functions[_whois:$host] )); then "_whois:$host" "$expl[@]" else _message "identifier" @@ -165,13 +171,13 @@ _whois_fwhois () { if compset -P '*@'; then _whois_hosts "$@" else - if [[ -z "$QIPREFIX" ]]; then + if [[ -z "$QIPREFIX" && -z "$PREFIX" ]]; then compadd -QS '' \' return fi compset -q host="$_whois_defaultserver" - if builtin functions "_whois:$host" >&-; then + if (( $+functions[_whois:$host] )); then "_whois:$host" "$@" else _message "identifier" @@ -189,7 +195,7 @@ _whois_ports () { compadd "$@" - whois || _ports "$@" } -builtin functions _whois:whois.internic.net >&- || +(( $+functions[_whois:whois.internic.net] )) || _whois:whois.internic.net () { if (( CURRENT == 1 )); then compadd HELP DOMAIN HOST @@ -198,7 +204,7 @@ _whois:whois.internic.net () { fi } -builtin functions _whois:whois.nic.ad.jp >&- || +(( $+functions[_whois:whois.nic.ad.jp] )) || _whois:whois.nic.ad.jp () { if (( CURRENT == 1 )); then compadd HELP DOM NET HOST PERSON CONN COM -- cgit 1.4.1