blob: 5c0a70da7a5b72c043edbbeea84a6166830f4be6 (
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
|
#compdef telnet
# Parameter used:
#
# telnet_hosts_ports_users
# The array that contains 3-tuples `host:port:user'.
local state line expl
typeset -A options
if (( ! $+_telnet_short )); then
local help="$(telnet -\? < /dev/null 2>&1)"
_telnet_short=()
[[ "$help" = *"[-8]"* ]] &&
_telnet_short=("$_telnet_short[@]" '-8[allow 8-Bit data]')
[[ "$help" = *"[-E]"* ]] &&
_telnet_short=("$_telnet_short[@]" '-E[disable an escape character]')
[[ "$help" = *"[-K]"* ]] &&
_telnet_short=("$_telnet_short[@]" '-K[no automatic login]')
[[ "$help" = *"[-L]"* ]] &&
_telnet_short=("$_telnet_short[@]" '-L[allow 8-Bit data on output]')
[[ "$help" = *"[-N]"* ]] &&
_telnet_short=("$_telnet_short[@]" '-N[supress reverse lookup]')
[[ "$help" = *"[-S tos]"* ]] &&
_telnet_short=("$_telnet_short[@]" '-S+:IP type-of-service:')
[[ "$help" = *"[-X atype]"* ]] &&
_telnet_short=("$_telnet_short[@]" '-X+:authentication type to disable:')
[[ "$help" = *"[-a]"* ]] &&
_telnet_short=("$_telnet_short[@]" '-a[attempt automatic login]')
[[ "$help" = *"[-c]"* ]] &&
_telnet_short=("$_telnet_short[@]" '-c[disable .telnetrc]')
[[ "$help" = *"[-d]"* ]] &&
_telnet_short=("$_telnet_short[@]" '-d[debug mode]')
[[ "$help" = *"[-e char]"* ]] &&
_telnet_short=("$_telnet_short[@]" '-e+[specify escape character]:escape character:')
[[ "$help" = *"[-f/-F]"* ]] &&
_telnet_short=("$_telnet_short[@]" '-f' '-F')
[[ "$help" = *"[-k realm]"* ]] &&
_telnet_short=("$_telnet_short[@]" '-k+:realm:')
[[ "$help" = *"[-l user]"* ]] &&
_telnet_short=("$_telnet_short[@]" '-l+[specify user]:user:->users')
[[ "$help" = *"[-n tracefile]"* ]] &&
_telnet_short=("$_telnet_short[@]" '-n+[specify tracefile]:tracefile:_files')
[[ "$help" = *"[-r]"* ]] &&
_telnet_short=("$_telnet_short[@]" '-r[rlogin like user interface]')
[[ "$help" = *"[-s src_addr]"* ]] &&
_telnet_short=("$_telnet_short[@]" '-s+[set source IP address]:src_addr:')
[[ "$help" = *"[-x]"* ]] &&
_telnet_short=("$_telnet_short[@]" '-x')
[[ "$help" = *"[-t transcom]"* ]] &&
_telnet_short=("$_telnet_short[@]" '-t+:transcom:')
# _arguments cannot handle following three options.
_telnet_long=()
[[ "$help" = *"[-noasynch]"* ]] &&
_telnet_long=("$_telnet_long[@]" '-noasynch')
[[ "$help" = *"[-noasyncnet]"* ]] &&
_telnet_long=("$_telnet_long[@]" '-noasyncnet')
[[ "$help" = *"[-noasynctty]"* ]] &&
_telnet_long=("$_telnet_long[@]" '-noasynctty')
fi
[[ $#_telnet_long != 0 && (
-z "$compconfig[option_prefix]" ||
"$compconfig[option_prefix]" = *\!${words[1]}* ||
"$PREFIX" = [-+]* ) ]] && {
_description expl 'option'
_describe -o option _telnet_long "$expl[@]"
}
_arguments -s \
"$_telnet_short[@]" \
':host:->hosts' \
':port:->ports'
case "$state" in
hosts)
_description expl 'host'
_combination telnet_hosts_ports_users \
${options[-l]:+users=${options[-l]:q}} \
hosts "$expl[@]"
;;
ports)
_description expl 'port'
_combination telnet_hosts_ports_users \
${options[-l]:+users=${options[-l]:q}} \
hosts="${line[2]:q}" \
ports "$expl[@]"
;;
users)
_description expl 'user'
_combination telnet_hosts_ports_users \
${line[2]:+hosts="${line[2]:q}"} \
${line[3]:+ports="${line[3]:q}"} \
users "$expl[@]"
;;
esac
|