about summary refs log tree commit diff
path: root/Completion/User/_telnet
blob: 82fd6b21ccba1643cb5c97954e96048fa448c0be (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
#compdef telnet

# Parameter used:
#
#  telnet_hosts_ports_users
#    The array that contains 3-tuples `host:port:user'.

local state line expl
typeset -A options

_arguments -s \
  -{F,f,x} \
  '-8[allow 8-Bit data]' \
  '-E[disable an escape character]' \
  '-K[no automatic login]' \
  '-L[allow 8-Bit data on output]' \
  '-S+:IP type-of-service:' \
  '-X+:authentication type to disable:' \
  '-a[attempt automatic login]' \
  '-c[disable .telnetrc]' \
  '-d[debug mode]' \
  '-e+[specify escape character]:escape character:' \
  '-k+:realm:' \
  '-l+[specify user]:user:->users' \
  '-n+[specify tracefile]:tracefile:_files' \
  '-r[rlogin like user interface]' \
  ':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