From: Sven Wischnowsky <wischnow@informatik.hu-berlin.de>
To: zsh-workers@sunsite.auc.dk
Subject: PATCH: _nslookup
Date: Thu, 20 Jan 2000 16:23:37 +0100 (MET) [thread overview]
Message-ID: <200001201523.QAA29411@beta.informatik.hu-berlin.de> (raw)
This at least tries to get sensible values for the domains, either
from the domains style or from /etc/resolv.conf.
Bye
Sven
diff -ru ../z.old/Completion/User/.distfiles Completion/User/.distfiles
--- ../z.old/Completion/User/.distfiles Thu Jan 20 11:00:53 2000
+++ Completion/User/.distfiles Thu Jan 20 16:16:55 2000
@@ -1,7 +1,7 @@
DISTFILES_SRC='
.distfiles
_a2ps _archie _bison _bunzip2 _bzip2 _chown _compress _configure _cvs
- _dd _dir_list _dirs _dvi _find _flex _gcc _gdb _gprof _groups _gs
+ _dd _dir_list _dirs _domains _dvi _find _flex _gcc _gdb _gprof _groups _gs
_gunzip _gv _gzip _hosts _ispell _killall _lp _lynx _mailboxes _make _man
_mh _mount _mutt _my_accounts _netscape _nslookup _other_accounts
_pack _patch _pbm _pdf _perl_basepods _perl_builtin_funcs
diff -ru ../z.old/Completion/User/_domains Completion/User/_domains
--- ../z.old/Completion/User/_domains Thu Jan 20 16:17:16 2000
+++ Completion/User/_domains Thu Jan 20 16:15:37 2000
@@ -0,0 +1,20 @@
+#autoload
+
+local expl domains tmp
+
+if ! zstyle -a ":completion${curcontext}:domains" domains domains; then
+ if (( ! $+_cache_domains )); then
+ _cache_domains=()
+ if [[ -f /etc/resolv.conf ]]; then
+ while read tmp; do
+ [[ "$tmp" = (domain|search)* ]] &&
+ _cache_domains=( "$_cache_domains[@]" "${=${tmp%%[ ]#}#*[ ]}" )
+ done < /etc/resolv.conf
+ _cache_domains=( "${(@)_nslookup_domains:#[ ]#}" )
+ fi
+ fi
+ domains=( "$_cache_domains[@]" )
+fi
+
+_wanted domains expl domain &&
+ compadd -M 'm:{a-zA-Z}={A-Za-z} r:|.=* r:|=*' "$@" "$expl[@]" - "$domains[@]"
diff -ru ../z.old/Completion/User/_nslookup Completion/User/_nslookup
--- ../z.old/Completion/User/_nslookup Thu Jan 20 11:00:55 2000
+++ Completion/User/_nslookup Thu Jan 20 16:16:39 2000
@@ -38,7 +38,7 @@
'(noignoretc)ignoretc[ignore packet truncation errors]' \
'(ignoretc)noignoretc[don'"'"'t ignore packet truncation errors]' \
'class[change query class]:query class:((in\:Internet\ class chaos\:CHAOS\ class hesiod\:MIT\ Athena\ Hesiod\ class any\:wildcard\ \(any\ of\ the\ above\)))'
- 'domain[change default domain]:default domain:_hosts'
+ "domain[change default domain]:default domain:_domains"
'srchlist[change default domain and search list]: :->srchlist'
'port[change name server port]:name server port:'
{query,}type'[change type of information query]:query information type:((a\:internet\ address cname\:canonical\ name\ for\ alias hinfo\:CPU\ and\ operating\ system\ type minfo\:mailbox\ or\ mail\ list\ information mx\:mail\ exchanger ns\:name\ server\ for\ zone ptr\:host\ name\ or\ other\ information soa\:domain\'"'"'s\ \`start-of-authority\'"'"'\ information txt\:text\ information uinfo\:user\ information wks\:supported\ well-known\ services))'
@@ -53,8 +53,8 @@
_funcall ret _nslookup_command && return ret
_alternative \
- 'commands:command:compadd server lserver root finger ls view help set' \
- 'hosts:: _host' && ret=0
+ 'commands:command:(server lserver root finger ls view help set exit)' \
+ 'hosts:: _hosts' && ret=0
return ret
elif [[ "$compstate[context]" = redirect ]]; then
@@ -103,7 +103,7 @@
'-d[all records]' \
'-h[CPU and operating system information]' \
'-s[well-known services]' \
- ':domain:_hosts'
+ ":domain:_domains"
return
;;
view)
@@ -141,17 +141,17 @@
# This is completion after `srchlist' for both types.
if [[ -n "$state" ]]; then
- _tags hosts || return 1
+ _tags domains || return 1
if compset -P '*/'; then
- _description hosts expl 'search list entry'
+ _description domains expl 'search list entry'
else
- _description hosts expl 'default domain name and first search list entry'
+ _description domains expl 'default domain name and first search list entry'
fi
if [[ -n "$_vals_cache_multi" ]]; then
- _hosts "$expl[@]" -qS/ -r "/\\- \\t\\n$_vals_cache_multi"
+ _domains "$expl[@]" -qS/ -r "/\\- \\t\\n$_vals_cache_multi"
else
- _hosts "$expl[@]" -qS/
+ _domains "$expl[@]" -qS/
fi
return
fi
diff -ru ../z.old/Doc/Zsh/compsys.yo Doc/Zsh/compsys.yo
--- ../z.old/Doc/Zsh/compsys.yo Thu Jan 20 10:47:47 2000
+++ Doc/Zsh/compsys.yo Thu Jan 20 16:20:13 2000
@@ -453,6 +453,9 @@
item(tt(displays))(
for X display names
)
+item(tt(domains))(
+for network domains
+)
item(tt(expansions))(
used by the tt(_expand) completer for possible expansions
)
@@ -706,6 +709,11 @@
This is used with the tt(cvs) tag by the function completing for the
tt(cvs) command to decide if the tt(zsh/stat) module should be used to
generate only names of modified files in the appropriate places.
+)
+item(tt(domains))(
+If set, gives the names of network domains that should be
+completed. If this is not set by the user domain names mentioned in
+tt(/etc/resolv.conf) will be used.
)
item(tt(expand))(
Like tt(cursor), this style is used with the tt(paths) tag. If its
--
Sven Wischnowsky wischnow@informatik.hu-berlin.de
next reply other threads:[~2000-01-20 15:23 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2000-01-20 15:23 Sven Wischnowsky [this message]
2000-01-20 15:55 Sven Wischnowsky
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200001201523.QAA29411@beta.informatik.hu-berlin.de \
--to=wischnow@informatik.hu-berlin.de \
--cc=zsh-workers@sunsite.auc.dk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).