mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-10-26 04:30:27 +01:00
zsh-workers/9390
This commit is contained in:
parent
74be4d9a37
commit
e7de8c77d4
9 changed files with 642 additions and 25 deletions
|
|
@ -1,34 +1,27 @@
|
|||
# Simple wrapper function for `nslookup'. With completion if you are using
|
||||
# the function based completion system.
|
||||
|
||||
setopt localoptions completealiases
|
||||
setopt localoptions localtraps completealiases
|
||||
|
||||
local char line compcontext=nslookup pid
|
||||
local tmp line compcontext=nslookup curcontext=':nslookup' pmpt
|
||||
|
||||
trap 'print -p exit;return' INT
|
||||
trap 'return 130' INT
|
||||
trap 'zpty -d nslookup' EXIT
|
||||
|
||||
coproc command nslookup
|
||||
pid=$!
|
||||
zstyle -s ':nslookup' prompt pmpt || pmpt='> '
|
||||
|
||||
while read -pk 1 char; do
|
||||
line="$line$char"
|
||||
[[ "$line" = *'
|
||||
> ' ]] && break
|
||||
done
|
||||
print -nr - "$line"
|
||||
zpty nslookup nslookup
|
||||
|
||||
line=''
|
||||
while vared -p '> ' line; do
|
||||
print -p "$line"
|
||||
line=''
|
||||
while read -pk 1 char; do
|
||||
line="$line$char"
|
||||
[[ "$line" = *'
|
||||
> ' ]] && break
|
||||
done
|
||||
print -nr - "$line"
|
||||
line=''
|
||||
zpty -r nslookup line '*> '
|
||||
print -nr "$line"
|
||||
|
||||
while line=''; vared -p "$pmpt" line; do
|
||||
[[ "$line" = exit ]] && break
|
||||
|
||||
zpty -w nslookup "$line"
|
||||
|
||||
zpty -r nslookup line '*> '
|
||||
print -nr "$line"
|
||||
done
|
||||
|
||||
print -p exit
|
||||
wait $pid
|
||||
zpty -w nslookup 'exit'
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue