mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-09-23 17:01:05 +02:00
33 lines
772 B
Text
33 lines
772 B
Text
# Simple wrapper function for `nslookup'. With completion if you are using
|
|
# the function based completion system.
|
|
|
|
setopt localoptions localtraps completealiases
|
|
|
|
local tmp line compcontext=nslookup curcontext='nslookup:::' pmpt
|
|
|
|
zmodload -e zsh/zpty || zmodload -i zsh/zpty
|
|
|
|
trap 'return 130' INT
|
|
trap 'zpty -d nslookup' EXIT
|
|
|
|
pmpt=()
|
|
zstyle -s ':nslookup' prompt tmp && pmpt=(-p "$tmp")
|
|
zstyle -s ':nslookup' rprompt tmp && pmpt=("$pmpt[@]" -r "$tmp")
|
|
(( $#pmpt )) || pmpt=(-p '> ')
|
|
|
|
zpty nslookup nslookup
|
|
|
|
zpty -r nslookup line '*> '
|
|
print -nr "$line"
|
|
|
|
while line=''; vared -he "$pmpt[@]" line; do
|
|
print -s "$line"
|
|
[[ "$line" = exit ]] && break
|
|
|
|
zpty -w nslookup "$line"
|
|
|
|
zpty -r nslookup line '*> ' || break
|
|
print -nr "$line"
|
|
done
|
|
|
|
zpty -w nslookup 'exit'
|