about summary refs log tree commit diff
path: root/Functions/Misc/nslookup
blob: 8cbbdce6b6cd18120461de028029790323e2c2bf (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# 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

trap 'return 130' INT
trap 'zpty -d nslookup' EXIT

zstyle -s ':nslookup' prompt pmpt || pmpt='> '

zpty nslookup nslookup

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

zpty -w nslookup 'exit'